﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
//using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;

using CE.Mail;
using CE.Global;
using CE.User;
using CE.CarInsurance;
using CE.Provider;
using CE.Security;
using CE.InputOut;
using CE.Database;

public partial class car_insurance_hsbc_proposal_excel : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            //Response.Write("..etiqa<br/>");
            //SendEtiqa();
            //Response.Write("..SENT");

            //Response.Write("..generate<br/>");
            //GenerateProposalFormToEtiqa(28863, @"D:\sharedloc\exceloutput\etiqa\", "E288FC_14-03-2011");
            //Response.Write("..etiqa xls");

            //Response.Write("...LibertyNotification<br/>");
            //ProposalNotification();
            //Response.Write("done!");

            //Response.Write("start generating PDF...");
            //LibertyCarInsurancePDFOutput GeneratePDF = new LibertyCarInsurancePDFOutput();
            //GeneratePDFProposalForm(23167, 0);
            //Response.Write("PDF done!");

            //GenerateProposalForm(1364);
            //GenerateExcel(471);


            //Response.Write("...");
            //GenerateCIHTML_Hsbc(471);
            //Response.Write("Excel done!");
            //GenerateHSBCPDFProposalForm(7066);



        }
    }

    protected void Send_Click(object sender, EventArgs e)
    {
        Int64 _carid = 0;
        string _filelocation = "";
        string _paymentmode = "";

        _carid = Convert.ToInt64(txtCarId.Text.Trim());
        _filelocation = txtFileLocation.Text.Trim();
        _paymentmode = ddlPaymentMode.Text;

        if (ddlProvider.Text == "LIBERTY")
        {
            if (ddlSendTo.Text == "Customer")
            {
                ProposalNotificationToCustomer(_carid, _filelocation, _paymentmode);
            }
            else
            {
                ProposalNotificationToProvider(_carid, _filelocation);
            }
        }
        else
        {
            string _fileloctax = txtFileLocTax.Text.Trim();
            string _fileloccert = txtFileLocCert.Text.Trim();
            string _filelocsched = txtFileLocSchedule.Text.Trim();

            if (ddlSendTo.Text == "Customer")
            {
                SendEtiqa(_carid, _fileloctax, _fileloccert, _filelocsched);
            }
            
        }


        btnSend.Enabled = false;
        lblContent.Text = "Sent!";
    }

    protected void ProviderChange(object sender, EventArgs e)
    {
        if (ddlProvider.Text == "LIBERTY")
        {
            pnlEtiqa.Visible = false;
            pnlLiberty.Visible = true;
        }
        else if (ddlProvider.Text == "ETIQA")
        {
            pnlEtiqa.Visible = true;
            pnlLiberty.Visible = false;
        }
        else if (ddlProvider.Text == "HSBC")
        {
            pnlEtiqa.Visible = false;
            pnlLiberty.Visible = true;
        }
        else
        {
            pnlEtiqa.Visible = false;
            pnlLiberty.Visible = false;
        }
    }

    #region LIBERTY
    private void ProposalNotificationToCustomer(Int64 _carid, string _filelocation, string _paymentmode)
    {
        string _strSql, _providerName, _providerEmail, _providerCCEmail, _providerBCCEmail, _Date, _Time, _InsuranceName, _RefNo;
        MyDatabase _db = new MyDatabase();
        DataTable _dtProvider = new DataTable();
        DataTable _dtInsurance = new DataTable();
        _Date = "";
        _Time = "";
        _RefNo = "";
        _strSql = "";
        _providerName = "";
        _providerEmail = "";
        _providerCCEmail = "";
        _providerBCCEmail = "";
        _InsuranceName = "Car Insurance";

         int _ProviderId = 29;
         Int64 _CarId = _carid;
         Int64 _ceid = 0;

        _strSql = "SELECT [CompanyName], [Email1] FROM tblProviderCompany WHERE ProviderCompanyId = " + _ProviderId.ToString();

        _dtProvider = _db.GetDataTable(_strSql);
        if (_dtProvider.Rows.Count > 0)
        {
            _providerName = _dtProvider.Rows[0]["CompanyName"].ToString();      
            _providerEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("LibertyCI_TO");
            _providerCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("LibertyCI_CC");
            _providerBCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("LibertyCI_BCC");
        }
        _strSql = "";
        _strSql = "SELECT CONVERT(VARCHAR,ModifiedDate,103) AS [Date], CONVERT(VARCHAR,ModifiedDate,108) AS [Time], RefCEUserId, QuoteRefNo  ";
        _strSql += " FROM  tblCarMoreDetail_Liberty WHERE CECarId = " + _CarId.ToString() + " ORDER BY ModifiedDate DESC";
        _dtInsurance = _db.GetDataTable(_strSql);
        if (_dtInsurance.Rows.Count > 0)
        {
            _Date = _dtInsurance.Rows[0]["Date"].ToString();
            _Time = _dtInsurance.Rows[0]["Time"].ToString();
            _ceid = Convert.ToInt64(_dtInsurance.Rows[0]["RefCEUserId"].ToString());
            _RefNo = _dtInsurance.Rows[0]["QuoteRefNo"].ToString();
        }
        if ((_dtProvider.Rows.Count > 0) && (_dtInsurance.Rows.Count > 0))
        {
            string[] filelist = new string[1];
            filelist[0] = _filelocation;
        
            string chkprov_email = _providerEmail.Trim();

            string ccemail = "";
            if (chkprov_email.Remove(0, chkprov_email.Length - 1) == ";")
            {
                ccemail = _providerEmail + _providerCCEmail;
            }
            else
            {
                ccemail = _providerEmail + ";" + _providerCCEmail;
            }

            string _PaymentMode = _paymentmode;           

            MyMailManager.SendCarLibertyProposalToUserWithAttachment(_providerName, getUserEmail(_ceid), ccemail, _providerBCCEmail, _InsuranceName, _Date, _Time, _RefNo, filelist, _PaymentMode);
        }

    }

    private void ProposalNotificationToProvider(Int64 _carid, string _filelocation)
    {
        string _strSql, _providerName, _providerEmail, _providerCCEmail, _providerBCCEmail, _Date, _Time, _InsuranceName, _RefNo;
        MyDatabase _db = new MyDatabase();
        DataTable _dtProvider = new DataTable();
        DataTable _dtInsurance = new DataTable();
        _Date = "";
        _Time = "";
        _RefNo = "";
        _strSql = "";
        _providerName = "";
        _providerEmail = "";
        _providerCCEmail = "";
        _providerBCCEmail = "";
        _InsuranceName = "Car Insurance";

        int _ProviderId = 29;
        Int64 _CarId = _carid;
      
        _strSql = "SELECT [CompanyName], [Email1] FROM tblProviderCompany WHERE ProviderCompanyId = " + _ProviderId.ToString();

        _dtProvider = _db.GetDataTable(_strSql);
        if (_dtProvider.Rows.Count > 0)
        {
            _providerName = _dtProvider.Rows[0]["CompanyName"].ToString();
            _providerEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("LibertyCI_TO");
            _providerCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("LibertyCI_CC");
            _providerBCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("LibertyCI_BCC");
        }
        _strSql = "";
        _strSql = "SELECT CONVERT(VARCHAR,ModifiedDate,103) AS [Date], CONVERT(VARCHAR,ModifiedDate,108) AS [Time], QuoteRefNo ";
        _strSql += " FROM  tblCarMoreDetail_Liberty WHERE CECarId = " + _CarId.ToString() + " ORDER BY ModifiedDate DESC";
        _dtInsurance = _db.GetDataTable(_strSql);
        if (_dtInsurance.Rows.Count > 0)
        {
            _Date = _dtInsurance.Rows[0]["Date"].ToString();
            _Time = _dtInsurance.Rows[0]["Time"].ToString();
            _RefNo = _dtInsurance.Rows[0]["QuoteRefNo"].ToString();
        }

        //_RefNo = General.GetRefNumber("CI", _Date, Session[General.CarId].ToString());
        //_RefNo = "L333IA";

        if ((_dtProvider.Rows.Count > 0) && (_dtInsurance.Rows.Count > 0))
        {
            string[] filelist = new string[1];
            //filelist[0] = @"D:\sharedloc\pdfoutput\liberty\2011Apr21\L333IA_21-04-2011.pdf";
            filelist[0] = _filelocation;

            MyMailManager.SendProposalCompleteNotificationWithAttachment(_providerName, _providerEmail, _providerCCEmail, _providerBCCEmail, _InsuranceName, _Date, _Time, _RefNo, filelist);

            //generate PDF
            //MyMailManager.SendProposalCompleteNotificationWithAttachment(_providerName, _providerEmail, _providerCCEmail, _providerBCCEmail, _InsuranceName, _Date, _Time, _RefNo, GeneratePDFProposalForm(_CarId, 1));

        }

    }

    private string getUserEmail(Int64 _ceid)
    {
        string UserEmail = "";
        Account _account = new Account();
        AccountDB _accountdb = new AccountDB();

        _account = _accountdb.GetAccount(_ceid);
        if (_account != null)
        {
            UserEmail = _account.Email;
        }

        return UserEmail;

    }

    protected void GenerateProposalForm(Int64 RefID)
    {
        string _fileName = "FileName";
        string _applicationdate = " : " + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "/" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "/" + CE.Global.General.GetUTCDateTime().Year + " " + CE.Global.General.GetUTCDateTime().ToShortTimeString();
        string convertno = General.GetRefNumber(RefID);
        _fileName = "L" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

        //lblContent.Text = GenerateCIHTML_Hsbc(RefID);
        //lblContent.Text = GenerateCIHTML_Liberty(RefID);


        //hplnkPolicyDoc.NavigateUrl = _lnkTest.ResolveClientUrl(docurl);
        Image imgHeader = new Image();

        imgHeader.ImageUrl = imgHeader.ResolveClientUrl("~/proposalforms/libertyheader_ed.jpg");

        StringBuilder strText = new StringBuilder("");
        strText.Append("<table><tr><td><h3>Liberty Insurance </h3></td><td></td><td colspan='2' align='right'> </td></tr>"
            + "<tr><td colspan='3'><img src='/proposalforms/libertyheader_ed.jpg' /></td></tr></table>");

        //strText.Append("<table><tr><td><h3>Liberty Insurance </h3></td><td></td><td colspan='2' align='right'> </td></tr>"
        //    + "<tr><td colspan='3'><img src='" + imgHeader.ResolveClientUrl("~/proposalforms/libertyheader_ed.jpg") + "' /></td></tr></table>");

        lblContent.Text = strText + GenerateCIHTML_Liberty(RefID);

        //"libertyheader_ed.jpg"
        //MyIO myio = new MyIO();
        //string _excelfile = Server.MapPath("proposalforms/" + _fileName + ".xls");
        //string[] filecontent = new string[1];
        //filecontent[0] = lblContent.Text.ToString();
        //myio.WriteNewFile(AppDomain.CurrentDomain.BaseDirectory + "car_insurance\\proposalforms\\", _fileName + ".xls", filecontent);


        //ExportGridView(RefID, _fileName, lblContent, strText.ToString());

    }

    public string GenerateCIHTML_Liberty(Int64 RefId)
    {
        DataSet _dsProposal = new DataSet();
        ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
        _dsProposal = _proposaldownloaddb.GetLibertyProposal(RefId, "CI");
        string _html = "";
        string convertno = General.GetRefNumber(RefId);

        if (_dsProposal.Tables[0].Rows.Count > 0)
        {
            #region variables
            string _name, _unitno, _homeno, _address, _postalcode, _dob, _dd, _mm, _yy, _nationality, _nric, _maritalstatus, _officeno, _mobile;
            string _gender, _expdriving, _vehicleno, _make, _model, _vehicletype, _engineno, _chassisno, _cc, _regyear, _mfgyear, _hpstatus, _hpcomp;
            string _insstartdate, _insenddate, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _insstatus, _inscomp, _insvhleno, _insncdentitle;
            string _inspldate, _indd, _inmm, _inyy, _ncdreson, _bodytype, _occupation, _empname, _drwestmylsa, _vhlemodifystatus, _vhlemodifyreason;
            string _drname1, _drage1, _drgender1, _drmarital1, _drocc1, _drexp1, _drname2, _drage2, _drgender2, _drmarital2, _drocc2, _drexp2;
            string _drname3, _drage3, _drgender3, _drmarital3, _drocc3, _drexp3, _drname4, _drage4, _drgender4, _drmarital4, _drocc4, _drexp4;
            string _drname5, _drage5, _drgender5, _drmarital5, _drocc5, _drexp5, _demeritstatus, _demeritcount, _dmdrname1, _dmdrpoint1;
            string _drDOB1, _drDOB2, _drDOB3, _drDOB4, _drDOB5;
            string _dmdrdate1, _dmdrtype1, _dmdrname2, _dmdrpoint2, _dmdrdate2, _dmdrtype2, _dmdrname3, _dmdrpoint3, _dmdrdate3, _dmdrtype3;
            string _dmdrname4, _dmdrpoint4, _dmdrdate4, _dmdrtype4, _dmdrname5, _dmdrpoint5, _dmdrdate5, _dmdrtype5, _dmdrname6, _dmdrpoint6;
            string _dmdrdate6, _dmdrtype6, _adddriver, _drcount, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _claimstatus, _claim1ststat, _claim1stend;
            string _claimcount1, claimamt1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _ncdnil;
            string _inscancelstatus, _cancelreason, _impairstatus, _impairreason, _accessorystatus, _accessorydetail, _convictedstatus, _convictedreason, _planname, _annualpremium;
            string _insrefusedstatus, _refusedreason, _jobnature, _email;
            string _drjobnature1, _drjobnature2, _drjobnature3, _drjobnature4, _drjobnature5;

            DateTime _dofb, _isdate, _iedate, _indate;

            _email = "";
            _jobnature = ""; _drjobnature1 = ""; _drjobnature2 = ""; _drjobnature3 = ""; _drjobnature4 = ""; _drjobnature5 = "";
            _inscancelstatus = ""; _cancelreason = ""; _impairstatus = ""; _impairreason = ""; _demeritstatus = ""; _demeritcount = "";
            _dmdrname1 = ""; _dmdrpoint1 = ""; _dmdrdate1 = ""; _dmdrtype1 = ""; _dmdrname2 = ""; _dmdrpoint2 = ""; _dmdrdate2 = ""; _dmdrtype2 = "";
            _dmdrname3 = ""; _dmdrpoint3 = ""; _dmdrdate3 = ""; _dmdrtype3 = ""; _dmdrname4 = ""; _dmdrdate4 = ""; _dmdrtype4 = "";
            _dmdrpoint4 = ""; _dmdrname5 = ""; _dmdrpoint5 = ""; _dmdrdate5 = ""; _dmdrtype5 = ""; _dmdrname6 = "";
            _dmdrpoint6 = ""; _dmdrdate6 = ""; _dmdrtype6 = ""; _vehicletype = ""; _expdriving = "";
            _drname1 = ""; _drage1 = ""; _drgender1 = ""; _drmarital1 = ""; _drocc1 = ""; _drexp1 = "";
            _drname2 = ""; _drage2 = ""; _drgender2 = ""; _drmarital2 = ""; _drocc2 = ""; _drexp2 = "";
            _drname3 = ""; _drage3 = ""; _drgender3 = ""; _drmarital3 = ""; _drocc3 = ""; _drexp3 = "";
            _drname4 = ""; _drage4 = ""; _drgender4 = ""; _drmarital4 = ""; _drocc4 = ""; _drexp4 = "";
            _drname5 = ""; _drage5 = ""; _drgender5 = ""; _drmarital5 = ""; _drocc5 = ""; _drexp5 = ""; _planname = ""; _annualpremium = "";
            _adddriver = ""; _drcount = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";
            _insrefusedstatus = ""; _refusedreason = "";
            _drDOB1 = ""; _drDOB2 = ""; _drDOB3 = ""; _drDOB4 = ""; _drDOB5 = "";

            _name = _dsProposal.Tables[0].Rows[0]["Name"].ToString();
            _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
            _dd = _dofb.Day.ToString("00");
            _mm = _dofb.Month.ToString("00");
            _yy = _dofb.Year.ToString();
            //_dob = _dd + "/" + _mm + "/" + _yy;
            _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
            _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
            _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
            _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
            _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
            _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
            _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
            _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
            _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();
            _jobnature = _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
            _email = CE.Security.MySecurity.Decrypt(_dsProposal.Tables[0].Rows[0]["Email"].ToString(), true);

            _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
            _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();

            _drwestmylsa = _dsProposal.Tables[0].Rows[0]["DrWMalaysia"].ToString();
            _expdriving = _dsProposal.Tables[0].Rows[0]["YearDriveSg"].ToString();
            _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString();
            _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
            _officeno = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            _empname = _dsProposal.Tables[0].Rows[0]["EmpNameandTrade"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
            {
                _claimstatus = "No";
            }
            else
            {
                _claimstatus = "Yes";
            }
            if (_dsProposal.Tables[0].Rows[0]["HasPreInsurer"].ToString() == "True")
            {
                _insstatus = "Yes";
                if (_dsProposal.Tables[2].Rows.Count > 0)
                {
                    _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();
                    _insvhleno = _dsProposal.Tables[0].Rows[0]["PreInsVechicleNo"].ToString();
                    _indate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString());
                    _indd = _indate.Day.ToString("00");
                    _inmm = _indate.Month.ToString("00");
                    _inyy = _indate.Year.ToString();
                    //_inspldate = _dd + "/" + _mm + "/" + _yy;
                    _inspldate = _dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString();
                    if (_dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() == "-1")
                    {
                        _insncdentitle = "";
                    }
                    else
                    {
                        _insncdentitle = _dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() + "%";
                    }
                }
                else
                {
                    _insstatus = "No";
                    _inscomp = "";
                    _insvhleno = "";
                    _inspldate = "";
                    _insncdentitle = "";
                }
            }
            else
            {
                _insstatus = "No";
                _inscomp = "";
                _insvhleno = "";
                _inspldate = "";
                _insncdentitle = "";
            }

            _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
            if (_ncdpercent.ToString() == "-1")
            {
                _ncdpercent = "No NCD(First Policy)";
            }
            else
            {
                _ncdpercent += "%";
            }
            _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
            if (_ncdreson == "Others")
            {
                _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
            }
            else if (_ncdreson == "-1")
            {
                _ncdreson = "";
            }
            if (_dsProposal.Tables[1].Rows.Count > 0)
            {
                _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
                _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
                claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
                _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

                _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
                _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
                claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

                _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
                _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
                claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
            }
            else
            {
                _claim1ststat = "";
                _claim1stend = "";
                claimamt1 = "";
                _claimcount1 = "0";

                _claim2ndstat = "";
                _claim2ndend = "";
                claimamt2 = "";

                _claim3rdstat = "";
                _claim3rdend = "";
                claimamt3 = "";
                _claimstatus = "No";
                _ncdpercent = "0%";
            }
            _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
            if (_ncdpercent.ToString() == "-1")
            {
                _ncdpercent = "10%";
            }
            else
            {
                if (_claimstatus == "No")
                {
                    _ncdpercent = NoNCD(_ncdpercent);
                }
                else if (_claimstatus == "Yes" && _claimcount1 == "0")
                {
                    _ncdpercent = NoNCD(_ncdpercent);
                }
                else if (_claimstatus == "Yes" && _claimcount1 == "1")
                {
                    _ncdpercent = OneTimesNCD(_ncdpercent);
                }
                else
                {
                    _ncdpercent = "0%";
                }
            }
            if (_dsProposal.Tables[0].Rows[0]["HasVechicleModified"].ToString() == "True")
            {
                _vhlemodifystatus = "Yes";
                _vhlemodifyreason = _dsProposal.Tables[0].Rows[0]["VechicleModifyReason"].ToString();
            }
            else
            {
                _vhlemodifystatus = "No";
                _vhlemodifyreason = "";
            }
            if (_dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString() == "True")
            {
                _inscancelstatus = "Yes";
                _cancelreason = _dsProposal.Tables[0].Rows[0]["InsuranceTerminatedReason"].ToString();
            }
            else
            {
                _inscancelstatus = "No";
                _cancelreason = "";
            }

            if (_dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString() == "True")
            {
                _impairstatus = "Yes";
                _impairreason = _dsProposal.Tables[0].Rows[0]["PhysicalImpairmentReason"].ToString();
            }
            else
            {
                _impairstatus = "No";
                _impairreason = "";
            }
            if (_dsProposal.Tables[0].Rows[0]["HasConvictedMoterOffence"].ToString() == "True")
            {
                _convictedstatus = "Yes";
                _convictedreason = _dsProposal.Tables[0].Rows[0]["ConvictedReason"].ToString();
            }
            else
            {
                _convictedstatus = "No";
                _convictedreason = "";
            }
            if (_dsProposal.Tables[0].Rows[0]["HasAccessory"].ToString() == "True")
            {
                _accessorystatus = "Yes";
                _accessorydetail = _dsProposal.Tables[0].Rows[0]["AccessoryDescription"].ToString();
            }
            else
            {
                _accessorystatus = "No";
                _accessorydetail = "";
            }


            if (_dsProposal.Tables[0].Rows[0]["Info1"].ToString() == "1")
            {
                _insrefusedstatus = "Yes";
                _refusedreason = _dsProposal.Tables[0].Rows[0]["Info2"].ToString();
            }
            else
            {
                _insrefusedstatus = "No";
                _refusedreason = "";
            }

            if (_dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString() == "True")
            {
                if (_dsProposal.Tables[6].Rows.Count > 0)
                {
                    _demeritstatus = "Yes";
                    _demeritcount = _dsProposal.Tables[6].Rows.Count.ToString();

                    _dmdrname1 = _dsProposal.Tables[6].Rows[0]["DriverName"].ToString();
                    _dmdrpoint1 = _dsProposal.Tables[6].Rows[0]["TotalDemeritPoints"].ToString();
                    _dmdrdate1 = _dsProposal.Tables[6].Rows[0]["DemeritDate"].ToString();
                    _dmdrtype1 = _dsProposal.Tables[6].Rows[0]["TypeofOffence"].ToString();

                    if (_dsProposal.Tables[6].Rows.Count > 1)
                    {
                        _dmdrname2 = _dsProposal.Tables[6].Rows[1]["DriverName"].ToString();
                        _dmdrpoint2 = _dsProposal.Tables[6].Rows[1]["TotalDemeritPoints"].ToString();
                        _dmdrdate2 = _dsProposal.Tables[6].Rows[1]["DemeritDate"].ToString();
                        _dmdrtype2 = _dsProposal.Tables[6].Rows[1]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 2)
                    {
                        _dmdrname3 = _dsProposal.Tables[6].Rows[2]["DriverName"].ToString();
                        _dmdrpoint3 = _dsProposal.Tables[6].Rows[2]["TotalDemeritPoints"].ToString();
                        _dmdrdate3 = _dsProposal.Tables[6].Rows[2]["DemeritDate"].ToString();
                        _dmdrtype3 = _dsProposal.Tables[6].Rows[2]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 3)
                    {
                        _dmdrname4 = _dsProposal.Tables[6].Rows[3]["DriverName"].ToString();
                        _dmdrpoint4 = _dsProposal.Tables[6].Rows[3]["TotalDemeritPoints"].ToString();
                        _dmdrdate4 = _dsProposal.Tables[6].Rows[3]["DemeritDate"].ToString();
                        _dmdrtype4 = _dsProposal.Tables[6].Rows[3]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 4)
                    {
                        _dmdrname5 = _dsProposal.Tables[6].Rows[4]["DriverName"].ToString();
                        _dmdrpoint5 = _dsProposal.Tables[6].Rows[4]["TotalDemeritPoints"].ToString();
                        _dmdrdate5 = _dsProposal.Tables[6].Rows[4]["DemeritDate"].ToString();
                        _dmdrtype5 = _dsProposal.Tables[6].Rows[4]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 5)
                    {
                        _dmdrname6 = _dsProposal.Tables[6].Rows[5]["DriverName"].ToString();
                        _dmdrpoint6 = _dsProposal.Tables[6].Rows[5]["TotalDemeritPoints"].ToString();
                        _dmdrdate6 = _dsProposal.Tables[6].Rows[5]["DemeritDate"].ToString();
                        _dmdrtype6 = _dsProposal.Tables[6].Rows[5]["TypeofOffence"].ToString();
                    }
                }
                else
                {
                    _demeritstatus = "No";
                    _demeritcount = "0";
                }
            }
            else
            {
                _demeritstatus = "No";
                _demeritcount = "0";
            }

            _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
            _mfgyear = _dsProposal.Tables[0].Rows[0]["ManufactYear"].ToString();
            _regyear = _dsProposal.Tables[0].Rows[0]["DateofReg"].ToString();
            _model = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
            _make = _dsProposal.Tables[5].Rows[0]["Make"].ToString();
            _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
            _vehicletype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
            _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
            _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

            _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
            _isdd = _isdate.Day.ToString("00");
            _ismm = _isdate.Month.ToString("00");
            _isyy = _isdate.Year.ToString();
            //_insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
            _insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

            _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
            _iedd = _iedate.Day.ToString("00");
            _iemm = _iedate.Month.ToString("00");
            _ieyy = _iedate.Year.ToString();
            //_insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
            _insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

            if (_dsProposal.Tables[3].Rows.Count > 0)
            {
                _hpstatus = "Yes";
                _hpcomp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

                if (_hpcomp.ToString() == "")
                {
                    _hpcomp = "Not Applicable";
                }
            }
            else
            {
                _hpstatus = "No";
                _hpcomp = "Not Applicable";
            }
            if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
            {
                _adddriver = "Yes";
                _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
            }
            else
            {
                _adddriver = "No";
                _drcount = "0";
            }
            if (_dsProposal.Tables[4].Rows.Count > 0)
            {
                if (Convert.ToInt16(_drcount) > 0)
                {
                    _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
                    _drage1 = _dsProposal.Tables[4].Rows[0]["Age"].ToString();
                    _drgender1 = _dsProposal.Tables[4].Rows[0]["Gender"].ToString();
                    _drmarital1 = _dsProposal.Tables[4].Rows[0]["Marital"].ToString();
                    _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
                    _drexp1 = _dsProposal.Tables[4].Rows[0]["YearOfDrivingInSg"].ToString();
                    _drDOB1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
                    _drjobnature1 = _dsProposal.Tables[4].Rows[0]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
                    _drage2 = _dsProposal.Tables[4].Rows[1]["Age"].ToString();
                    _drgender2 = _dsProposal.Tables[4].Rows[1]["Gender"].ToString();
                    _drmarital2 = _dsProposal.Tables[4].Rows[1]["Marital"].ToString();
                    _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
                    _drexp2 = _dsProposal.Tables[4].Rows[1]["YearOfDrivingInSg"].ToString();
                    _drDOB2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
                    _drjobnature2 = _dsProposal.Tables[4].Rows[1]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
                    _drage3 = _dsProposal.Tables[4].Rows[2]["Age"].ToString();
                    _drgender3 = _dsProposal.Tables[4].Rows[2]["Gender"].ToString();
                    _drmarital3 = _dsProposal.Tables[4].Rows[2]["Marital"].ToString();
                    _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
                    _drexp3 = _dsProposal.Tables[4].Rows[2]["YearOfDrivingInSg"].ToString();
                    _drDOB3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
                    _drjobnature3 = _dsProposal.Tables[4].Rows[2]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
                    _drage4 = _dsProposal.Tables[4].Rows[3]["Age"].ToString();
                    _drgender4 = _dsProposal.Tables[4].Rows[3]["Gender"].ToString();
                    _drmarital4 = _dsProposal.Tables[4].Rows[3]["Marital"].ToString();
                    _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
                    _drexp4 = _dsProposal.Tables[4].Rows[3]["YearOfDrivingInSg"].ToString();
                    _drDOB4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
                    _drjobnature4 = _dsProposal.Tables[4].Rows[3]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
                    _drage5 = _dsProposal.Tables[4].Rows[4]["Age"].ToString();
                    _drgender5 = _dsProposal.Tables[4].Rows[4]["Gender"].ToString();
                    _drmarital5 = _dsProposal.Tables[4].Rows[4]["Marital"].ToString();
                    _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
                    _drexp5 = _dsProposal.Tables[4].Rows[4]["YearOfDrivingInSg"].ToString();
                    _drDOB5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
                    _drjobnature5 = _dsProposal.Tables[4].Rows[4]["JobNature"].ToString();
                }
            }
            _nameofcard = _dsProposal.Tables[0].Rows[0]["NameoftheCard"].ToString();
            _issuebank = _dsProposal.Tables[0].Rows[0]["IssuingBankName"].ToString();
            _cno = _dsProposal.Tables[0].Rows[0]["CreditCardNo"].ToString();
            _ccexmm = _dsProposal.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
            _ccexyy = _dsProposal.Tables[0].Rows[0]["CardExpiryYear"].ToString();
            _cctype = _dsProposal.Tables[0].Rows[0]["CardType"].ToString();
            _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);

            #endregion

            //_html = "<table><tr><td width='25%'>Plan Name</td><td>" + _planname + "</td><td colspan='2' align='right'>Annual Premium : $" + _annualpremium.ToString() + "</td></tr></table>";
            _html = "<table><tr><td colspan='4'> </td></tr></table>";
            _html += "<table><tr><td colspan='4' align='center'><b>MOTOR INSURANCE PROPOSAL</b></td></tr></table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
                     + "<tr>"
                     + "<td width='50%'>" //Start 1
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                     + "<tr>"
                     + "<td width='50%' align='left'><b>Reference Number</b> </td>"
                     + "<td width='50%' align='left'>" + "L" + convertno.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2'><b>Insured's Particulars</b></td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>IC/ROC Number</td>"
                     + "<td width='50%' align='left'>" + _nric.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td align='left' >Address</td>"
                     + "<td align='left'>"
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0'>"
                     + "<tr><td align='left'>#" + _unitno.ToString() + " - " + _homeno.ToString() + "</td></tr>"
                     + "<tr><td align='left'>" + _address.ToString() + "</td></tr>"
                     + "<tr><td align='left'>Postal Code " + _postalcode.ToString() + "</td></tr>"
                     + "</table>"
                     + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2'> </td>"
                     + "</tr>"

                     + "</table>"
                     + "</td>" //End 1

                     + "<td width='50%'>" //Start 2
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"


                     + "<tr>"
                     + "<td width='50%' align='left'>Date</td>"
                     + "<td width='50%' align='left'>" + CE.Global.General.GetUTCDateTime().ToString("dd-mm-yyyy") + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2'> </td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Name</td>"
                     + "<td width='50%' align='left'>" + _name.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2'> </td>"
                     + "</tr>"
                     + "<tr>"
                     + "<td colspan='2'> </td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left' >Mobile No./Office No.</td>"
                     + "<td width='50%' align='left' >" + _mobile.ToString() + " / " + _officeno.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2'> </td>"
                     + "</tr>"


                     //+ "<tr>"
                //+ "<td width='50%' align='left'>Nationality</td>"
                //+ "<td width='50%' align='left'>" + _nationality.ToString() + "</td>"
                //+ "</tr>"


                     + "</table>"
                     + "</td>" //End 2
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2'>"
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                    + "<tr>"
                    + "<td width='50%' align='left'>Employer's Name & Trade </td>"
                    + "<td width='50%' align='left'>" + _empname.ToString() + "</td>"
                    + "<td width='50%' align='left'>Email Address</td>"
                     + "<td width='50%' align='left'>" + _email.ToString() + "</td>"
                    + "</tr>"

                    + "<tr>"
                    + "<td colspan='4' align='left'> </td>"
                    + "</tr>"

                    + "<tr>"
                    + "<td colspan='4' align='left' width='100%'>"
                    + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
                    + "<tr>"
                    + "<td align='center' width='16%'><b>Name</b></td>"
                    + "<td align='center' width='14%'><b>Sex</b></td>"
                    + "<td align='center' width='14%'><b>Date of Birth</b></td>"
                    + "<td align='center' width='14%'><b>Occupation</b></td>"
                    + "<td align='center' width='14%'><b>Indoor/Outdoor</b></td>"
                    + "<td align='center' width='14%'><b>Marital Status</b></td>"
                    + "<td align='center' width='14%'><b>Driving XP(Yrs)</b></td>"
                    + "</tr>"
                    + "<tr>"
                    + "<td align='center' width='16%'>" + _name.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _gender.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _dob.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _occupation.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _jobnature.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _maritalstatus.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _expdriving.ToString() + "</td>"
                    + "</tr>";

            for (int i = 1; i <= Convert.ToInt16(_drcount); i++)
            {
                if (i == 1)
                {
                    _html += "<tr>"
                    + "<td align='center' width='16%'>" + _drname1.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _drgender1.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _drDOB1.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _drocc1.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _drjobnature1.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _drmarital1.ToString() + "</td>"
                    + "<td align='center' width='14%'>" + _drexp1.ToString() + "</td>"
                    + "</tr>";
                }
                if (i == 2)
                {
                    _html += "<tr>"
                   + "<td align='center' width='16%'>" + _drname2.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drgender2.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drDOB2.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drocc2.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drjobnature2.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drmarital2.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drexp2.ToString() + "</td>"
                   + "</tr>";
                }

                if (i == 3)
                {
                    _html += "<tr>"
                   + "<td align='center' width='16%'>" + _drname3.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drgender3.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drDOB3.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drocc3.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drjobnature3.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drmarital3.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drexp3.ToString() + "</td>"
                   + "</tr>";
                }

                if (i == 4)
                {
                    _html += "<tr>"
                   + "<td align='center' width='16%'>" + _drname4.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drgender4.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drDOB4.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drocc4.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drjobnature4.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drmarital4.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drexp4.ToString() + "</td>"
                   + "</tr>";
                }

                if (i == 5)
                {
                    _html += "<tr>"
                   + "<td align='center' width='16%'>" + _drname5.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drgender5.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drDOB5.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drocc5.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drjobnature5.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drmarital5.ToString() + "</td>"
                   + "<td align='center' width='14%'>" + _drexp5.ToString() + "</td>"
                   + "</tr>";
                }

            }

            _html += "<tr>"
            + "<td align='center' width='16%'></td>"
            + "<td align='center' width='14%'></td>"
            + "<td align='center' width='14%'></td>"
            + "<td align='center' width='14%'></td>"
            + "<td align='center' width='14%'></td>"
            + "<td align='center width='14%''></td>"
            + "<td align='center' width='14%'></td>"
            + "</tr>"
            + "<tr>"
            + "<td colspan='7' align='center'></td>"
            + "</tr>"
            + "</table>"

            + "</td>"
            + "</tr>";


            //if (claimamt1.ToString() == "0")
            //{
            //    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
            //    + "<td style='width:25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _claim1ststat.ToString() + " to " + _claim1stend.ToString() + "</td>"
            //    + "<td style='width: 25%' align='left'> Claim Amount</td>"
            //    + "<td style='width: 25%' align='left'>" + claimamt1.ToString() + "</td></tr>";
            //}
            //if (claimamt2.ToString() == "0")
            //{
            //    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
            //    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim2ndstat.ToString() + " to " + _claim2ndend.ToString() + "</td>"
            //    + "<td style='width: 25%' align='left'> Claim Amount</td>"
            //    + "<td style='width: 25%' align='left'>" + claimamt2.ToString() + "</td></tr>";
            //}
            //if (claimamt3.ToString() == "0")
            //{
            //    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
            //    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim3rdstat.ToString() + " to " + _claim3rdend.ToString() + "</td>"
            //    + "<td style='width: 25%' align='left'> Claim Amount</td>"
            //    + "<td style='width: 25%' align='left'>" + claimamt3.ToString() + "</td></tr>";
            //}

            //_html += "<tr><td style='width:25%' align='left'>NCD on next renewal (%)</td>"
            //+ "<td colspan='3' align='left'>" + _ncdpercent.ToString() + "</td></tr>";



            _html += "<tr><td colspan='4' align='left'><b>Vehicle Details</b></td></tr>"

             + "<tr><td style='width:25%' align='left'>Vehicle Number</td>"
             + "<td style='width: 25%' align='left'>" + _insvhleno.ToString() + "</td>"
             + "<td style='width: 25%' align='left'></td>"
             + "<td style='width: 25%' align='left'></td></tr>"

             + "<tr><td style='width:25%' align='left'>Chassis No</td>"
             + "<td style='width: 25%' align='left'>" + _chassisno.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Body Type</td>"
             + "<td style='width: 25%' align='left'>" + _vehicletype.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Engine No</td>"
             + "<td style='width: 25%' align='left'>" + _engineno.ToString() + "</td>"
             + "<td style='width: 25%' align='left'></td>"
             + "<td style='width: 25%' align='left'></td></tr>"

             + "<tr><td style='width:25%' align='left'>Make</td>"
             + "<td style='width: 25%' align='left'>" + _make.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Year of Manufacture</td>"
             + "<td style='width: 25%' align='left'>" + _mfgyear.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Model</td>"
             + "<td style='width: 25%' align='left'>" + _model.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Year of Registration</td>"
             + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _regyear.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Engine CC/Ton</td>"
             + "<td style='width: 25%' align='left'>" + _cc.ToString() + "</td>"
             + "<td style='width: 25%' align='left'></td>"
             + "<td style='width: 25%' align='left'></td></tr>"

             + "<tr><td colspan='4' align='left'><b></b></td></tr>"
             + "<tr><td colspan='4' align='left'><b>Claim Details</b></td></tr>"

             + "<tr><td style='width:25%' align='left'>Current Insurance Co.</td>"
             + "<td style='width: 25%' align='left'>" + _inscomp.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Vehicle No.</td>"
             + "<td style='width: 25%' align='left'>" + _insvhleno.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Policy No</td>"
             + "<td style='width: 25%;></td>"
             + "<td style='width: 25%' align='left'>Expiry/Cancellation Date</td>"
                //+ "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _inspldate.ToString() + "</td></tr>"
             + "<td style='width: 25%; align='left'>" + _inspldate.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Last 3 years claim XP</td>"
             + "<td style='width: 25%' align='left'>" + _claimstatus.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>No Claims in the last 3 Years</td>"
             + "<td style='width: 25%' align='left'></td></tr>"

             + "<tr><td style='width:25%' align='left'>NCD%</td>"
             + "<td style='width: 25%' align='left'>" + _insncdentitle.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>OFD</td>"
             + "<td style='width: 25%' align='left'></td></tr>"

             + "<tr><td style='width:25%' align='left'>NCD Protector</td>"
             + "<td style='width: 25%' align='left'></td>"
             + "<td style='width: 25%' align='left'></td>"
             + "<td style='width: 25%' align='left'></td></tr>"

             + "<tr><td colspan='4' align='left'></td></tr>";

            //+ "<tr><td style='width:25%' align='left'>Any hire purchase to your motor vehicle?</td>"
            //+ "<td style='width: 25%' align='left'>" + _hpstatus.ToString() + "</td>"
            //+ "<td style='width: 25%' align='left'>Hire Purchase Company</td>"
            //+ "<td style='width: 25%' align='left'>" + _hpcomp.ToString() + "</td></tr>"

            // + "<tr><td colspan='4' align='left'>Do you have any motor vehicle Insurance? " + _insstatus.ToString() + "</td></tr>";

            _html += "<tr><td colspan='4' align='left'>If NCD is NIL, Please Provide Details : " + _ncdreson.ToString() + " </td></tr>"
            + "<tr><td colspan='4' align='left'>Has the vehicle been modified/converted in anyway from the manufacturer's specifications? " + _vhlemodifystatus.ToString() + "</td></tr>";
            if (_vhlemodifystatus.ToString() == "Yes")
            {
                _html += "<tr><td style='width:25%' align='left'>Reason</td>"
                     + "<td colspan'3' align='left'>" + _vhlemodifyreason.ToString() + "</td></tr>";
            }

            //_html += "<tr><td colspan='4' align='left'>Are there any additional accessories installed on the vehicle? " + _accessorystatus.ToString() + "</td></tr>";
            if (_vhlemodifystatus.ToString() == "Yes")
            {
                _html += "<tr><td style='width:25%' align='left'>Accessories Details</td>"
                     + "<td colspan'3' align='left'>" + _accessorydetail.ToString() + "</td></tr>";
            }

            _html += "<tr><td colspan='4' align='left'> </td></tr>"
            + "<tr><td colspan='4' align='left'><b>Policy Details</b></td></tr>"

            + "<tr><td style='width:25%' align='left'>Finance Company</td>"
            + "<td style='width: 25%' align='left'>" + _issuebank.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"

            + "<tr><td style='width:25%' align='left'>Usage</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'>Type of Cover</td>"
            + "<td style='width: 25%' align='left'>" + _planname + "</td></tr>"

            + "<tr><td style='width:25%' align='left'>Period From </td>"
            + "<td style='width: 25%' align='left'>" + _insstartdate.ToString() + "</td>"
            + "<td style='width: 25%' align='left'>Period To</td>"
            + "<td style='width: 25%' align='left'>" + _insenddate + "</td></tr>"

            + "<tr><td colspan='4' align='left'> </td></tr>"
            + "<tr><td colspan='4' align='left'><b>Other Information</b></td></tr>"

            + "<tr><td colspan='3' align='left'>How often do you drive to West Malaysia?</td>"
            + "<td align='left'>" + _drwestmylsa.ToString() + "</td></tr>"

            + "<tr><td colspan='4' align='left'>Have you or any driver named under Section V </td></tr>"

            + "<tr><td colspan='3' align='left'>1) Been convicted of any motoring offence (other than parking) in the past three (3) years or have prosecutions pending? </td>"
            + "<td> " + _convictedstatus.ToString() + " </td></tr>";

            if (_convictedstatus.ToString() == "Yes")
            {
                _html += "<tr><td style='width:25%' align='left'>Reason</td>"
                     + "<td colspan'3' align='left'>" + _convictedreason.ToString() + "</td></tr>";
            }

            //_html += "<tr><td colspan='4' align='left'><b>Other Information</td></tr>"

            _html += "<tr><td colspan='3' align='left'>20 Been given demerit points? If Yes, please state name of driver,total no of demerit points accumulated during the last 24 mths,the date and type of offence.</td>"
            + "<td style='width: 25%' align='left'>" + _demeritstatus.ToString() + "</td></tr>";
            if (Convert.ToInt16(_demeritcount) > 0)
            {
                _html += "<tr><td style='width:25%' align='left'>1. Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrname1.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrpoint1.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrtype1.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate1.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_demeritcount) > 1)
            {
                _html += "<tr><td style='width:25%' align='left'>2. Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrname2.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrpoint2.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrtype2.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate2.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_demeritcount) > 2)
            {
                _html += "<tr><td style='width:25%' align='left'>3. Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrname3.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrpoint3.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrtype3.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate3.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_demeritcount) > 3)
            {
                _html += "<tr><td style='width:25%' align='left'>4. Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrname4.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrpoint4.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrtype4.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate4.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_demeritcount) > 4)
            {
                _html += "<tr><td style='width:25%' align='left'>5. Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrname5.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrpoint5.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrtype5.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate5.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_demeritcount) > 5)
            {
                _html += "<tr><td style='width:25%' align='left'>5. Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrname6.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrpoint6.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
                + "<td style='width: 25%' align='left'>" + _dmdrtype6.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate6.ToString() + "</td></tr>";
            }
            _html += "<tr><td colspan='3' align='left'>3) Suffer from defective vision or hearing, heart condition, epilepsy, diabetes or any physical or mental disability or infirmity?</td>"
            + "<td style='width: 25%' align='left'>" + _impairstatus.ToString() + "</td></tr>";
            if (_impairstatus.ToString() == "Yes")
            {
                _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
                + "<td colspan='3' align='left'>" + _impairreason.ToString() + "</td></tr>";
            }

            _html += "<tr><td colspan='3' align='left'>4) Been refused motor insurance at any time or subjected to special conditions?</td>"
                  + "<td style='width: 25%' align='left'>" + _insrefusedstatus.ToString() + "</td></tr>";
            if (_insrefusedstatus.ToString() == "Yes")
            {
                _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
                + "<td colspan='3' align='left'>" + _refusedreason.ToString() + "</td></tr>";
            }


            _html += "<tr><td colspan='3' align='left'>5) Do you have any insurance terminated in the last 12 months due to a breach of any premium payment condition?</td>"
                    + "<td style='width: 25%' align='left'>" + _inscancelstatus.ToString() + "</td></tr>";
            if (_inscancelstatus.ToString() == "Yes")
            {
                _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
                + "<td colspan='3' align='left'>" + _cancelreason.ToString() + "</td></tr>";
            }


            _html += "<tr><td colspan='4' align='left'></td></tr>"
                //+ "<tr><td colspan='4' align='left'><b>Payment Before Cover Warranty (Private Vehicles)</td></tr>"
                //+"<tr><td colspan='4' align='left'>Please note that the total premium must be paid and actually received in full by the Company (or the intermediary through whom this policy was affected) on or"
                //+ " before the inception date of coverage, failing which the policy shall be deemed to be automatically cancelled and no benefits whatsoever shall be payable by the"
                //+ " Company</td></tr>"

            + "<tr><td colspan='4' align='left'><b>Premium Details</b></td></tr>"
            + "<tr><td colspan='4' align='left'>Quotation Period</td></tr>"

            + "<tr><td style='width:25%' align='left'>From Date</td>"
            + "<td style='width: 25%' align='left'>" + _insstartdate.ToString() + "</td>"
            + "<td style='width: 25%' align='left'>To Date</td>"
            + "<td style='width: 25%' align='left'>" + _insenddate.ToString() + "</td></tr>"

            + "<tr><td style='width:25%' align='left'>Annual Premium</td>"
            + "<td style='width: 25%' align='left'>$" + _annualpremium.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"

            + "<tr><td colspan='4' align='left'></td></tr>"
            + "<tr><td colspan='4' align='left'><b>Mode of Payment</b></td></tr>"

            + "<tr><td style='width:25%' align='left'>Mode</td>"
            + "<td style='width: 25%' align='left'>Credit Card</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"

            + "<tr><td style='width:25%' align='left'>Card Type</td>"
            + "<td style='width: 25%' align='left'>" + _cctype.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"

            + "<tr><td style='width:25%' align='left'>Card Number</td>"
            + "<td style='width: 25%' align='left'>" + _ccno.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"

            + "<tr><td style='width:25%' align='left'>Card expiry date</td>"
            + "<td style='width: 25%; mso-number-format:mmm\\-yyyy' align='left'>" + _ccexmm.ToString() + "/" + _ccexyy.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"


            + "<tr><td style='width:25%' align='left'>Card Holder's Name</td>"
            + "<td style='width: 25%' align='left'>" + _nameofcard.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"




            + "</table>"
            + "</td>"
            + "</tr>"

            + "</table>"
            + "</div></div>";
        }

        return _html;
    }

    #endregion LIBERTY

    //protected void GenerateExcel(Int64 RefID)
    //{
    //    Excel.Application oXL;
    //    Excel.Workbook oWB;
    //    Excel.Worksheet oSheet;
    //    Excel.Range oRange;

    //    // Start Excel and get Application object.
    //    oXL = new Excel.Application();

    //    // Set some properties
    //    oXL.Visible = true;
    //    oXL.DisplayAlerts = false;

    //    // Get a new workbook.
    //    oWB = oXL.Workbooks.Add(Missing.Value);

    //    // Get the active sheet
    //    oSheet = (Excel.Worksheet)oWB.ActiveSheet;
    //    oSheet.Name = "Liberty Proposal Form";


    //    DataSet _dsProposal = new DataSet();
    //    ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
    //    _dsProposal = _proposaldownloaddb.GetHSBCProposal(RefID, "CI");

    //    #region variables

    //    string _name, _dob, _nationality, _nric, _maritalstatus, _mobile, _hoemphone, _officephone, _faxno, _unitno, _homeno, _address;
    //    string _postalcode, _gender, _empname, _email, _claimstatus, _divclaimstatus, _dd, _mm, _yy, _occupation, _claim1ststat, _claim1stend, claimamt1;
    //    string _claimcount1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _inscomp;
    //    string _ncdreson, _vehicleno, _makemodel, _cc, _enginetype, _regyear, _offpeakcar, _bodytype, _purchaseprice, _engineno, _chassisno;
    //    string _insstartdate, _insenddate, _hp, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _drname1, _drdob1, _drdd1, _drmm1, _dryy1, _drocc1, _drnobus1;
    //    string _drname2, _drdob2, _drdd2, _drmm2, _dryy2, _drocc2, _drnobus2, _drname3, _drdob3, _drdd3, _drmm3, _dryy3, _drocc3, _drnobus3;
    //    string _drname4, _drdob4, _drdd4, _drmm4, _dryy4, _drocc4, _drnobus4, _drname5, _drdob5, _drdd5, _drmm5, _dryy5, _drocc5, _drnobus5;
    //    string _adddriver, _drcount, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _planname, _annualpremium;
    //    string _isyoungdriver, _iscompanycar, _isdeclined, _isnoncdprotect, _isCOE, _isSocialPurpose;
    //    DateTime _dofb, _isdate, _iedate, _drdofb1, _drdofb2, _drdofb3, _drdofb4, _drdofb5;

    //    _drname1 = ""; _drdob1 = ""; _drdd1 = ""; _drmm1 = ""; _dryy1 = ""; _drocc1 = ""; _drnobus1 = "";
    //    _drname2 = ""; _drdob2 = ""; _drdd2 = ""; _drmm2 = ""; _dryy2 = ""; _drocc2 = ""; _drnobus2 = "";
    //    _drname3 = ""; _drdob3 = ""; _drdd3 = ""; _drmm3 = ""; _dryy3 = ""; _drocc3 = ""; _drnobus3 = "";
    //    _drname4 = ""; _drdob4 = ""; _drdd4 = ""; _drmm4 = ""; _dryy4 = ""; _drocc4 = ""; _drnobus4 = "";
    //    _drname5 = ""; _drdob5 = ""; _drdd5 = ""; _drmm5 = ""; _dryy5 = ""; _drocc5 = ""; _drnobus5 = ""; _planname = ""; _annualpremium = "";
    //    _adddriver = ""; _drcount = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";
    //    _isyoungdriver = ""; _iscompanycar = ""; _isdeclined = ""; _isnoncdprotect = ""; _isCOE = ""; _isSocialPurpose = "";

    //    _name = _dsProposal.Tables[0].Rows[0]["FamilyName"].ToString() + " " + _dsProposal.Tables[0].Rows[0]["GivenName"].ToString();
    //    _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
    //    _dd = _dofb.Day.ToString("00");
    //    _mm = _dofb.Month.ToString("00");
    //    _yy = _dofb.Year.ToString().Substring(2, 2);
    //    //_dob = _dd + "/" + _mm + "/" + _yy;
    //    _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
    //    _empname = _dsProposal.Tables[0].Rows[0]["EmpName"].ToString();
    //    _email = CE.Security.MySecurity.Decrypt(_dsProposal.Tables[0].Rows[0]["Email"].ToString(), true);
    //    _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
    //    _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
    //    _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
    //    _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
    //    _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
    //    _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
    //    _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
    //    _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();

    //    _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
    //    _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();

    //    _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString() + " / " + _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
    //    _hoemphone = _dsProposal.Tables[0].Rows[0]["HomePhoneNo"].ToString();
    //    _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
    //    _officephone = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
    //    _faxno = _dsProposal.Tables[0].Rows[0]["FaxNo"].ToString();

    //    _isyoungdriver = _dsProposal.Tables[0].Rows[0]["Info1"].ToString();
    //    _iscompanycar = _dsProposal.Tables[0].Rows[0]["Info2"].ToString();
    //    _isdeclined = _dsProposal.Tables[0].Rows[0]["Info3"].ToString();
    //    _isnoncdprotect = _dsProposal.Tables[0].Rows[0]["Info4"].ToString();
    //    _isCOE = _dsProposal.Tables[0].Rows[0]["Info5"].ToString();
    //    _isSocialPurpose = _dsProposal.Tables[0].Rows[0]["Info6"].ToString();

    //    if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
    //    {
    //        _claimstatus = "No";
    //        _divclaimstatus = "none";
    //    }
    //    else
    //    {
    //        _claimstatus = "Yes";
    //        _divclaimstatus = "block";
    //    }
    //    if (_dsProposal.Tables[2].Rows.Count > 0)
    //    {
    //        _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();

    //        if (_inscomp.ToString() == "")
    //        {
    //            _ncdstatus = "Not Applicable";
    //        }
    //        else
    //        {
    //            _ncdstatus = "Yes";
    //        }
    //    }
    //    else
    //    {
    //        _ncdstatus = "No";
    //        _inscomp = "Not Applicable";
    //    }

    //    _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
    //    if (_ncdreson.ToString() == "Others")
    //    {
    //        _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
    //    }
    //    else if (_ncdreson.ToString() == "-1")
    //    {
    //        _ncdreson = "Not Applicable";
    //    }

    //    if (_dsProposal.Tables[1].Rows.Count > 0)
    //    {
    //        _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
    //        _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
    //        claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
    //        _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

    //        _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
    //        _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
    //        claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

    //        _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
    //        _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
    //        claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
    //        _divclaimstatus = "block";
    //    }
    //    else
    //    {
    //        _claim1ststat = "";
    //        _claim1stend = "";
    //        claimamt1 = "";
    //        _claimcount1 = "0";

    //        _claim2ndstat = "";
    //        _claim2ndend = "";
    //        claimamt2 = "";

    //        _claim3rdstat = "";
    //        _claim3rdend = "";
    //        claimamt3 = "";
    //        _divclaimstatus = "none";

    //        _ncdpercent = "0%";
    //    }
    //    _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
    //    if (_ncdpercent.ToString() == "-1")
    //    {
    //        _ncdpercent = "10%";
    //    }
    //    else
    //    {
    //        if (_claimstatus == "No")
    //        {
    //            _ncdpercent = NoNCD(_ncdpercent);
    //        }
    //        else if (_claimstatus == "Yes" && _claimcount1 == "0")
    //        {
    //            _ncdpercent = NoNCD(_ncdpercent);
    //        }
    //        else if (_claimstatus == "Yes" && _claimcount1 == "1")
    //        {
    //            _ncdpercent = OneTimesNCD(_ncdpercent);
    //        }
    //        else
    //        {
    //            _ncdpercent = "0%";
    //        }
    //    }
    //    _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
    //    _regyear = _dsProposal.Tables[0].Rows[0]["RegYear"].ToString();
    //    _makemodel = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
    //    _offpeakcar = _dsProposal.Tables[0].Rows[0]["Offbeak"].ToString();
    //    _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
    //    _enginetype = _dsProposal.Tables[0].Rows[0]["EngineType"].ToString();
    //    _bodytype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
    //    _purchaseprice = _dsProposal.Tables[0].Rows[0]["PurchasePrice"].ToString();
    //    _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
    //    _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

    //    _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
    //    _isdd = _isdate.Day.ToString("00");
    //    _ismm = _isdate.Month.ToString("00");
    //    _isyy = _isdate.Year.ToString().Substring(2, 2);
    //    //_insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
    //    _insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

    //    _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
    //    _iedd = _iedate.Day.ToString("00");
    //    _iemm = _iedate.Month.ToString("00");
    //    _ieyy = _iedate.Year.ToString().Substring(2, 2);
    //    //_insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
    //    _insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

    //    if (_dsProposal.Tables[3].Rows.Count > 0)
    //    {
    //        _hp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

    //        if (_hp.ToString() == "")
    //        {
    //            _hp = "Not Applicable";
    //        }
    //    }
    //    else
    //    {
    //        _hp = "Not Applicable";
    //    }
    //    if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
    //    {
    //        _adddriver = "Yes";
    //        _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
    //    }
    //    else
    //    {
    //        _adddriver = "No";
    //        _drcount = "0";
    //    }
    //    if (_dsProposal.Tables[4].Rows.Count > 0)
    //    {
    //        if (Convert.ToInt16(_drcount) > 0)
    //        {
    //            _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
    //            _drdofb1 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[0]["DOB"].ToString());
    //            _drdd1 = _drdofb1.Day.ToString("00");
    //            _drmm1 = _drdofb1.Month.ToString("00");
    //            _dryy1 = _drdofb1.Year.ToString().Substring(2, 2);
    //            //_drdob1 = _drdd1 + "/" + _drmm1 + "/" + _dryy1;
    //            _drdob1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
    //            _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
    //            _drnobus1 = _dsProposal.Tables[4].Rows[0]["DvrBusiness"].ToString();
    //        }
    //        if (Convert.ToInt16(_drcount) > 1)
    //        {
    //            _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
    //            _drdofb2 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[1]["DOB"].ToString());
    //            _drdd2 = _drdofb2.Day.ToString("00");
    //            _drmm2 = _drdofb2.Month.ToString("00");
    //            _dryy2 = _drdofb2.Year.ToString().Substring(2, 2);
    //            //_drdob2 = _drdd2 + "/" + _drmm2 + "/" + _dryy2;
    //            _drdob2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
    //            _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
    //            _drnobus2 = _dsProposal.Tables[4].Rows[1]["DvrBusiness"].ToString();
    //        }
    //        if (Convert.ToInt16(_drcount) > 2)
    //        {
    //            _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
    //            _drdofb3 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[2]["DOB"].ToString());
    //            _drdd3 = _drdofb3.Day.ToString("00");
    //            _drmm3 = _drdofb3.Month.ToString("00");
    //            _dryy3 = _drdofb3.Year.ToString().Substring(2, 2);
    //            //_drdob3 = _drdd3 + "/" + _drmm3 + "/" + _dryy3;
    //            _drdob3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
    //            _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
    //            _drnobus3 = _dsProposal.Tables[4].Rows[2]["DvrBusiness"].ToString();
    //        }
    //        if (Convert.ToInt16(_drcount) > 3)
    //        {
    //            _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
    //            _drdofb4 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[3]["DOB"].ToString());
    //            _drdd4 = _drdofb4.Day.ToString("00");
    //            _drmm4 = _drdofb4.Month.ToString("00");
    //            _dryy4 = _drdofb4.Year.ToString().Substring(2, 2);
    //            //_drdob4 = _drdd4 + "/" + _drmm4 + "/" + _dryy4;
    //            _drdob4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
    //            _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
    //            _drnobus4 = _dsProposal.Tables[4].Rows[3]["DvrBusiness"].ToString();
    //        }
    //        if (Convert.ToInt16(_drcount) > 4)
    //        {
    //            _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
    //            _drdofb5 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[4]["DOB"].ToString());
    //            _drdd5 = _drdofb5.Day.ToString("00");
    //            _drmm5 = _drdofb5.Month.ToString("00");
    //            _dryy5 = _drdofb5.Year.ToString().Substring(2, 2);
    //            //_drdob5 = _drdd5 + "/" + _drmm5 + "/" + _dryy5;
    //            _drdob5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
    //            _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
    //            _drnobus5 = _dsProposal.Tables[4].Rows[4]["DvrBusiness"].ToString();
    //        }
    //    }
    //    _nameofcard = _dsProposal.Tables[0].Rows[0]["NameoftheCard"].ToString();
    //    _issuebank = _dsProposal.Tables[0].Rows[0]["IssuingBankName"].ToString();
    //    _cno = _dsProposal.Tables[0].Rows[0]["CreditCardNo"].ToString();
    //    _ccexmm = _dsProposal.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
    //    _ccexyy = _dsProposal.Tables[0].Rows[0]["CardExpiryYear"].ToString();
    //    _cctype = _dsProposal.Tables[0].Rows[0]["CardType"].ToString();
    //    _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);

    //    #endregion


    //    string _fileName = "FileName";
    //    string _applicationdate = " : " + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "/" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "/" + CE.Global.General.GetUTCDateTime().Year + " " + CE.Global.General.GetUTCDateTime().ToShortTimeString();
    //    string convertno = General.GetRefNumber(RefID);
    //    _fileName = "H" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

    //    oSheet.Cells[1, 1] = "Car Insurance - Proposal Form";
    //    oSheet.get_Range("A1", "A1").Font.Bold = true;
    //    oSheet.get_Range("A1", "A1").Font.Size = 12;
    //    oSheet.Cells[1, 2] = _fileName;

    //    oSheet.Cells[1, 4] = "Application Date " + _applicationdate;
    //    oSheet.Cells[2, 4] = "Annual Premium: $" + _annualpremium;

    //    oSheet.get_Range("A1", "A44").ColumnWidth = 35;
    //    oSheet.get_Range("A1", "A44").WrapText = true;

    //    oSheet.get_Range("B1", "B44").ColumnWidth = 35;
    //    oSheet.get_Range("B1", "B44").WrapText = true;

    //    oSheet.get_Range("C1", "C44").ColumnWidth = 30;
    //    oSheet.get_Range("C1", "C44").WrapText = true;

    //    oSheet.get_Range("D1", "D44").ColumnWidth = 35;
    //    oSheet.get_Range("D1", "D44").WrapText = true;

    //    oSheet.get_Range("A1", "D44").HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft;

    //    oSheet.get_Range("A1", "D44").Borders.Weight = Excel.XlBorderWeight.xlThin;

    //    oSheet.Cells[4, 1] = "Plan Name";
    //    oSheet.Cells[4, 2] = _planname;

    //    oSheet.Cells[5, 1] = "Details of Proposer";
    //    oSheet.get_Range("A5", "A5").Font.Bold = true;

    //    oSheet.Cells[6, 1] = "Name (as shown in NRIC / Passport)";
    //    oSheet.Cells[6, 2] = _name;
    //    oSheet.Cells[6, 3] = "Date of Birth";
    //    oSheet.Cells[6, 4] = _dob;

    //    oSheet.Cells[7, 1] = "Nationality";
    //    oSheet.Cells[7, 2] = _nationality;
    //    oSheet.Cells[7, 3] = "Gender";
    //    oSheet.Cells[7, 4] = _gender;

    //    oSheet.Cells[8, 1] = "NRIC Number";
    //    oSheet.Cells[8, 2] = _nric;

    //    oSheet.Cells[9, 1] = "Marital Status";
    //    oSheet.Cells[9, 2] = _maritalstatus;

    //    oSheet.Cells[10, 1] = "Mobile No.";
    //    oSheet.Cells[10, 2] = _mobile;
    //    oSheet.Cells[10, 3] = "Office No.";
    //    oSheet.Cells[10, 4] = _officephone;

    //    oSheet.Cells[11, 1] = "Residential No.";
    //    oSheet.Cells[11, 2] = _hoemphone;
    //    oSheet.Cells[11, 3] = "Residential No.";
    //    oSheet.Cells[11, 4] = _faxno;

    //    oSheet.Cells[12, 1] = "Address";
    //    oSheet.Cells[12, 2] = _address;

    //    oSheet.Cells[13, 1] = "Postal Code";
    //    oSheet.Cells[13, 2] = _postalcode;

    //    oSheet.Cells[14, 1] = "Occupation/Nature of Business";
    //    oSheet.Cells[14, 2] = _occupation;
    //    oSheet.Cells[14, 3] = "Email Address";
    //    oSheet.Cells[14, 4] = _email;

    //    oSheet.Cells[16, 1] = "Name of employer";
    //    oSheet.Cells[16, 2] = _empname;

    //    oSheet.Cells[17, 1] = "At fault motor claims experiences, please provide the reason : " + _claimstatus.ToString();
    //    oSheet.get_Range("A17", "D17").Merge(true);

    //    oSheet.get_Range("A18", "D18").Merge(true);

    //    oSheet.Cells[19, 1] = "No Claim Discount(NCD) to be transferred to this insurance policy : " + _ncdstatus.ToString();
    //    oSheet.get_Range("A19", "D19").Merge(true);

    //    oSheet.Cells[20, 1] = "NCD on next renewal (%)";
    //    oSheet.Cells[20, 2] = _ncdpercent.ToString();
    //    oSheet.Cells[20, 3] = "Insurance Company";
    //    oSheet.Cells[20, 4] = _inscomp;

    //    oSheet.Cells[21, 1] = "If NCD is nil or 10% with no claims experiences, please provide reason :";
    //    oSheet.Cells[21, 2] = _ncdreson.ToString();

    //    oSheet.Cells[23, 1] = "Details of motor car to be insured";
    //    oSheet.get_Range("A23", "D23").Merge(true);
    //    oSheet.get_Range("A23", "A23").Font.Bold = true;

    //    oSheet.Cells[24, 1] = "Registration No";
    //    oSheet.Cells[24, 2] = _vehicleno.ToString();
    //    oSheet.Cells[24, 3] = "Year of Registration";
    //    oSheet.Cells[24, 4] = _regyear.ToString();

    //    oSheet.Cells[25, 1] = "Make and Model";
    //    oSheet.Cells[25, 2] = _makemodel.ToString();
    //    oSheet.Cells[25, 3] = "Off peak car?";
    //    oSheet.Cells[25, 4] = _offpeakcar;

    //    oSheet.Cells[26, 1] = "Cubic capacity (CC)";
    //    oSheet.Cells[26, 2] = _cc.ToString();
    //    oSheet.Cells[26, 3] = "Engine Type";
    //    oSheet.Cells[26, 4] = _enginetype;

    //    oSheet.Cells[27, 1] = "Type of Body";
    //    oSheet.Cells[27, 2] = _bodytype.ToString();
    //    oSheet.Cells[27, 3] = "Purchase price";
    //    oSheet.Cells[27, 4] = _purchaseprice;

    //    oSheet.Cells[28, 1] = "Engine Number";
    //    oSheet.Cells[28, 2] = _engineno.ToString();
    //    oSheet.Cells[28, 3] = "Chassis Number";
    //    oSheet.Cells[28, 4] = _chassisno;

    //    oSheet.Cells[29, 1] = "Name of hire purchase owner(s), if any";
    //    oSheet.Cells[29, 2] = _hp.ToString();
    //    oSheet.get_Range("A29", "B29").Merge(true);

    //    oSheet.get_Range("A30", "D30").Merge(true);

    //    oSheet.Cells[31, 1] = "Details of insurance required";
    //    oSheet.get_Range("A31", "D31").Merge(true);
    //    oSheet.get_Range("A31", "A31").Font.Bold = true;

    //    oSheet.Cells[32, 1] = "Period of insurance required";
    //    oSheet.get_Range("A32", "C32").Merge(true);
    //    oSheet.get_Range("A32", "C32").RowHeight = 30;
    //    DateTime dtStart = Convert.ToDateTime(_insstartdate);
    //    DateTime dtEnd = Convert.ToDateTime(_insenddate);

    //    oSheet.Cells[32, 4] = "From " + dtStart.ToShortDateString() + " To " + dtEnd.ToShortDateString();


    //    oSheet.Cells[33, 1] = "Would the car be driven by any Young and/or Inexperienced driver (aged below 26 years and/or has a full driving license for less than 2 years) ?";
    //    oSheet.get_Range("A33", "C33").Merge(true);
    //    oSheet.get_Range("A33", "C33").RowHeight = 30;
    //    oSheet.Cells[33, 4] = IsYesNo(_isyoungdriver);

    //    oSheet.Cells[34, 1] = "Company Registered Car";
    //    oSheet.get_Range("A34", "C34").Merge(true);
    //    oSheet.get_Range("A34", "C34").RowHeight = 30;
    //    oSheet.Cells[34, 4] = IsYesNo(_iscompanycar);

    //    oSheet.Cells[35, 1] = "Has any insurance company ever declined your proposal, cancelled or refused to renew your policy during the last 3 years?";
    //    oSheet.get_Range("A35", "C35").Merge(true);
    //    oSheet.get_Range("A35", "C35").RowHeight = 30;
    //    oSheet.Cells[35, 4] = IsYesNo(_isdeclined);

    //    oSheet.Cells[36, 1] = "I opt to insure with No Claim Discount Protection (Applicable to 50% NCD only)";
    //    oSheet.get_Range("A36", "C36").Merge(true);
    //    oSheet.get_Range("A36", "C36").RowHeight = 30;
    //    oSheet.Cells[36, 4] = IsYesNo(_isnoncdprotect);

    //    oSheet.Cells[37, 1] = "I opt to insure without COE/PARF";
    //    oSheet.get_Range("A37", "C37").Merge(true);
    //    oSheet.get_Range("A37", "C37").RowHeight = 30;
    //    oSheet.Cells[37, 4] = IsYesNo(_isCOE);

    //    oSheet.Cells[38, 1] = "Is the car being used for social, domestic and pleasure purposes and business of proposer, proposer's employer or partner?";
    //    oSheet.get_Range("A38", "C38").Merge(true);
    //    oSheet.get_Range("A38", "C38").RowHeight = 30;
    //    oSheet.Cells[38, 4] = IsYesNo(_isSocialPurpose);

    //    oSheet.Cells[39, 1] = "Details of main driver / named driver :";
    //    oSheet.get_Range("A39", "C39").Merge(true);
    //    oSheet.get_Range("A39", "A39").Font.Bold = true;
    //    oSheet.Cells[39, 4] = _adddriver.ToString();

    //    oSheet.get_Range("A40", "D40").Merge(true);

    //    oSheet.Cells[41, 1] = "Payment Mode : Credit Card";
    //    oSheet.get_Range("A41", "D41").Merge(true);
    //    oSheet.get_Range("A41", "A41").Font.Bold = true;

    //    oSheet.Cells[42, 1] = "Name of the Card";
    //    oSheet.Cells[42, 2] = _nameofcard.ToString();
    //    oSheet.Cells[42, 3] = "Issuing Bank";
    //    oSheet.Cells[42, 4] = _issuebank;

    //    oSheet.Cells[43, 1] = "Credit Card No.";
    //    oSheet.Cells[43, 2] = _ccno.ToString();
    //    oSheet.Cells[43, 3] = "Card expiry date";

    //    oSheet.Cells[43, 4] = _ccexmm.ToString() + "/" + _ccexyy.ToString();

    //    oSheet.Cells[44, 1] = "Type of Card";
    //    oSheet.Cells[44, 2] = _cctype.ToString();


    //    //oRange = oSheet.get_Range(1, 7);
    //    //oRange.EntireColumn.AutoFit();


    //    // Save the sheet and close
    //    oSheet = null;
    //    oRange = null;
    //    string _excelfile = Server.MapPath("proposalforms/" + _fileName + ".xls");

    //    oWB.SaveAs(_excelfile, Excel.XlFileFormat.xlWorkbookNormal,
    //        Missing.Value, Missing.Value, Missing.Value, Missing.Value,
    //        Excel.XlSaveAsAccessMode.xlExclusive,
    //        Missing.Value, Missing.Value, Missing.Value,
    //        Missing.Value, Missing.Value);
    //    oWB.Close(Missing.Value, Missing.Value, Missing.Value);
    //    oWB = null;
    //    oXL.Quit();

    //    // Clean up
    //    // NOTE: When in release mode, this does the trick
    //    GC.WaitForPendingFinalizers();
    //    GC.Collect();
    //    GC.WaitForPendingFinalizers();
    //    GC.Collect();
    //}
       
    public string GenerateCIHTML_Hsbc(Int64 RefId)
    {
        DataSet _dsProposal = new DataSet();
        ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
        _dsProposal = _proposaldownloaddb.GetHSBCProposal(RefId, "CI");
        string _html = "";
        if (_dsProposal.Tables[0].Rows.Count > 0)
        {
            string _name, _dob, _nationality, _nric, _maritalstatus, _mobile, _hoemphone, _officephone, _faxno, _unitno, _homeno, _address;
            string _postalcode, _gender, _empname, _email, _claimstatus, _divclaimstatus, _dd, _mm, _yy, _occupation, _claim1ststat, _claim1stend, claimamt1;
            string _claimcount1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _inscomp;
            string _ncdreson, _vehicleno, _makemodel, _cc, _enginetype, _regyear, _offpeakcar, _bodytype, _purchaseprice, _engineno, _chassisno;
            string _insstartdate, _insenddate, _hp, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _drname1, _drdob1, _drdd1, _drmm1, _dryy1, _drocc1, _drnobus1;
            string _drname2, _drdob2, _drdd2, _drmm2, _dryy2, _drocc2, _drnobus2, _drname3, _drdob3, _drdd3, _drmm3, _dryy3, _drocc3, _drnobus3;
            string _drname4, _drdob4, _drdd4, _drmm4, _dryy4, _drocc4, _drnobus4, _drname5, _drdob5, _drdd5, _drmm5, _dryy5, _drocc5, _drnobus5;
            string _adddriver, _drcount, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _planname, _annualpremium;
            string _isyoungdriver, _iscompanycar, _isdeclined, _isnoncdprotect, _isCOE, _isSocialPurpose;
            DateTime _dofb, _isdate, _iedate, _drdofb1, _drdofb2, _drdofb3, _drdofb4, _drdofb5;

            _drname1 = ""; _drdob1 = ""; _drdd1 = ""; _drmm1 = ""; _dryy1 = ""; _drocc1 = ""; _drnobus1 = "";
            _drname2 = ""; _drdob2 = ""; _drdd2 = ""; _drmm2 = ""; _dryy2 = ""; _drocc2 = ""; _drnobus2 = "";
            _drname3 = ""; _drdob3 = ""; _drdd3 = ""; _drmm3 = ""; _dryy3 = ""; _drocc3 = ""; _drnobus3 = "";
            _drname4 = ""; _drdob4 = ""; _drdd4 = ""; _drmm4 = ""; _dryy4 = ""; _drocc4 = ""; _drnobus4 = "";
            _drname5 = ""; _drdob5 = ""; _drdd5 = ""; _drmm5 = ""; _dryy5 = ""; _drocc5 = ""; _drnobus5 = ""; _planname = ""; _annualpremium = "";
            _adddriver = ""; _drcount = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";
            _isyoungdriver = ""; _iscompanycar = ""; _isdeclined = ""; _isnoncdprotect = ""; _isCOE = ""; _isSocialPurpose = "";

            _name = _dsProposal.Tables[0].Rows[0]["FamilyName"].ToString() + " " + _dsProposal.Tables[0].Rows[0]["GivenName"].ToString();
            _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
            _dd = _dofb.Day.ToString("00");
            _mm = _dofb.Month.ToString("00");
            _yy = _dofb.Year.ToString().Substring(2, 2);
            //_dob = _dd + "/" + _mm + "/" + _yy;
            _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
            _empname = _dsProposal.Tables[0].Rows[0]["EmpName"].ToString();
            _email = CE.Security.MySecurity.Decrypt(_dsProposal.Tables[0].Rows[0]["Email"].ToString(), true);
            _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
            _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
            _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
            _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
            _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
            _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
            _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
            _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();

            _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
            _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();

            _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString() + " / " + _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
            _hoemphone = _dsProposal.Tables[0].Rows[0]["HomePhoneNo"].ToString();
            _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
            _officephone = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            _faxno = _dsProposal.Tables[0].Rows[0]["FaxNo"].ToString();

            _isyoungdriver = _dsProposal.Tables[0].Rows[0]["Info1"].ToString();
            _iscompanycar = _dsProposal.Tables[0].Rows[0]["Info2"].ToString();
            _isdeclined = _dsProposal.Tables[0].Rows[0]["Info3"].ToString();
            _isnoncdprotect = _dsProposal.Tables[0].Rows[0]["Info4"].ToString();
            _isCOE = _dsProposal.Tables[0].Rows[0]["Info5"].ToString();
            _isSocialPurpose = _dsProposal.Tables[0].Rows[0]["Info6"].ToString();

            if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
            {
                _claimstatus = "No";
                _divclaimstatus = "none";
            }
            else
            {
                _claimstatus = "Yes";
                _divclaimstatus = "block";
            }
            if (_dsProposal.Tables[2].Rows.Count > 0)
            {
                _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();

                if (_inscomp.ToString() == "")
                {
                    _ncdstatus = "Not Applicable";
                }
                else
                {
                    _ncdstatus = "Yes";
                }
            }
            else
            {
                _ncdstatus = "No";
                _inscomp = "Not Applicable";
            }

            _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
            if (_ncdreson.ToString() == "Others")
            {
                _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
            }
            else if (_ncdreson.ToString() == "-1")
            {
                _ncdreson = "Not Applicable";
            }

            if (_dsProposal.Tables[1].Rows.Count > 0)
            {
                _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
                _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
                claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
                _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

                _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
                _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
                claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

                _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
                _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
                claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
                _divclaimstatus = "block";
            }
            else
            {
                _claim1ststat = "";
                _claim1stend = "";
                claimamt1 = "";
                _claimcount1 = "0";

                _claim2ndstat = "";
                _claim2ndend = "";
                claimamt2 = "";

                _claim3rdstat = "";
                _claim3rdend = "";
                claimamt3 = "";
                _divclaimstatus = "none";

                _ncdpercent = "0%";
            }
            _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
            if (_ncdpercent.ToString() == "-1")
            {
                _ncdpercent = "10%";
            }
            else
            {
                if (_claimstatus == "No")
                {
                    _ncdpercent = NoNCD(_ncdpercent);
                }
                else if (_claimstatus == "Yes" && _claimcount1 == "0")
                {
                    _ncdpercent = NoNCD(_ncdpercent);
                }
                else if (_claimstatus == "Yes" && _claimcount1 == "1")
                {
                    _ncdpercent = OneTimesNCD(_ncdpercent);
                }
                else
                {
                    _ncdpercent = "0%";
                }
            }
            _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
            _regyear = _dsProposal.Tables[0].Rows[0]["RegYear"].ToString();
            _makemodel = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
            _offpeakcar = _dsProposal.Tables[0].Rows[0]["Offbeak"].ToString();
            _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
            _enginetype = _dsProposal.Tables[0].Rows[0]["EngineType"].ToString();
            _bodytype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
            _purchaseprice = _dsProposal.Tables[0].Rows[0]["PurchasePrice"].ToString();
            _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
            _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

            _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
            _isdd = _isdate.Day.ToString("00");
            _ismm = _isdate.Month.ToString("00");
            _isyy = _isdate.Year.ToString().Substring(2, 2);
            //_insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
            _insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

            _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
            _iedd = _iedate.Day.ToString("00");
            _iemm = _iedate.Month.ToString("00");
            _ieyy = _iedate.Year.ToString().Substring(2, 2);
            //_insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
            _insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

            if (_dsProposal.Tables[3].Rows.Count > 0)
            {
                _hp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

                if (_hp.ToString() == "")
                {
                    _hp = "Not Applicable";
                }
            }
            else
            {
                _hp = "Not Applicable";
            }
            if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
            {
                _adddriver = "Yes";
                _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
            }
            else
            {
                _adddriver = "No";
                _drcount = "0";
            }
            if (_dsProposal.Tables[4].Rows.Count > 0)
            {
                if (Convert.ToInt16(_drcount) > 0)
                {
                    _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
                    _drdofb1 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[0]["DOB"].ToString());
                    _drdd1 = _drdofb1.Day.ToString("00");
                    _drmm1 = _drdofb1.Month.ToString("00");
                    _dryy1 = _drdofb1.Year.ToString().Substring(2, 2);
                    //_drdob1 = _drdd1 + "/" + _drmm1 + "/" + _dryy1;
                    _drdob1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
                    _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
                    _drnobus1 = _dsProposal.Tables[4].Rows[0]["DvrBusiness"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
                    _drdofb2 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[1]["DOB"].ToString());
                    _drdd2 = _drdofb2.Day.ToString("00");
                    _drmm2 = _drdofb2.Month.ToString("00");
                    _dryy2 = _drdofb2.Year.ToString().Substring(2, 2);
                    //_drdob2 = _drdd2 + "/" + _drmm2 + "/" + _dryy2;
                    _drdob2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
                    _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
                    _drnobus2 = _dsProposal.Tables[4].Rows[1]["DvrBusiness"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
                    _drdofb3 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[2]["DOB"].ToString());
                    _drdd3 = _drdofb3.Day.ToString("00");
                    _drmm3 = _drdofb3.Month.ToString("00");
                    _dryy3 = _drdofb3.Year.ToString().Substring(2, 2);
                    //_drdob3 = _drdd3 + "/" + _drmm3 + "/" + _dryy3;
                    _drdob3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
                    _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
                    _drnobus3 = _dsProposal.Tables[4].Rows[2]["DvrBusiness"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
                    _drdofb4 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[3]["DOB"].ToString());
                    _drdd4 = _drdofb4.Day.ToString("00");
                    _drmm4 = _drdofb4.Month.ToString("00");
                    _dryy4 = _drdofb4.Year.ToString().Substring(2, 2);
                    //_drdob4 = _drdd4 + "/" + _drmm4 + "/" + _dryy4;
                    _drdob4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
                    _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
                    _drnobus4 = _dsProposal.Tables[4].Rows[3]["DvrBusiness"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
                    _drdofb5 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[4]["DOB"].ToString());
                    _drdd5 = _drdofb5.Day.ToString("00");
                    _drmm5 = _drdofb5.Month.ToString("00");
                    _dryy5 = _drdofb5.Year.ToString().Substring(2, 2);
                    //_drdob5 = _drdd5 + "/" + _drmm5 + "/" + _dryy5;
                    _drdob5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
                    _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
                    _drnobus5 = _dsProposal.Tables[4].Rows[4]["DvrBusiness"].ToString();
                }
            }
            _nameofcard = _dsProposal.Tables[0].Rows[0]["NameoftheCard"].ToString();
            _issuebank = _dsProposal.Tables[0].Rows[0]["IssuingBankName"].ToString();
            _cno = _dsProposal.Tables[0].Rows[0]["CreditCardNo"].ToString();
            _ccexmm = _dsProposal.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
            _ccexyy = _dsProposal.Tables[0].Rows[0]["CardExpiryYear"].ToString();
            _cctype = _dsProposal.Tables[0].Rows[0]["CardType"].ToString();
            _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);

            _html = "<table><tr><td width='25%'>Plan Name</td><td>" + _planname + "</td><td colspan='2' align='right'>Annual Premium : $" + _annualpremium.ToString() + "</td></tr></table>";
            _html += "<div><div><b>Details of Proposer</b></div><div style='text-align: center'>"
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
                     + "<tr>"
                     + "<td width='50%'>" //Start 1
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Name (as shown in NRIC / Passport)</td>"
                     + "<td width='50%' align='left'>" + _name.ToString() + "</td>"
                     + "</tr>"

                      + "<tr>"
                     + "<td width='50%' align='left'>Nationality</td>"
                     + "<td width='50%' align='left'>" + _nationality.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>NRIC Number</td>"
                     + "<td width='50%' align='left'>" + _nric.ToString() + "</td>"
                     + "</tr>"


                     + "<tr>"
                     + "<td width='50%' align='left'>Marital Status</td>"
                     + "<td width='50%' align='left'>" + _maritalstatus.ToString() + "</td>"
                     + "</tr>"

                      + "<tr>"
                     + "<td width='50%' align='left'>Mobile No</td>"
                     + "<td width='50%' align='left'>" + _mobile.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Residential No</td>"
                     + "<td width='50%' align='left'>" + _hoemphone.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td align='left'>Address</td>"
                     + "<td align='left'>"
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0'>"
                     + "<tr><td align='left'>#" + _unitno.ToString() + " - " + _homeno.ToString() + "</td></tr>"
                     + "<tr><td align='left'>" + _address.ToString() + "</td></tr>"
                     + "</table>"
                     + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Postal Code</td>"
                     + "<td width='50%' align='left'>" + _postalcode.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Occupation / Nature of Business</td>"
                     + "<td width='50%' align='left'>" + _occupation.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan = '2'></td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Name of employer</td>"
                     + "<td width='50%' align='left'>" + _empname.ToString() + "</td>"
                     + "</tr>"

                     + "</table>"
                     + "</td>" //End 1

                     + "<td width='50%'>" //Start 2
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Date of Birth</td>"
                     + "<td width='50%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dob.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Gender</td>"
                     + "<td width='50%' align='left'>" + _gender.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'> </td>"
                     + "<td width='50%' align='left'> </td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'> </td>"
                     + "<td width='50%' align='left'></td>"
                     + "</tr>"


                     + "<tr>"
                     + "<td width='50%' align='left'>Office No</td>"
                     + "<td width='50%' align='left'>" + _officephone.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Fax No</td>"
                     + "<td width='50%' align='left'>" + _faxno.ToString() + "</td>"
                     + "</tr>"

                    + "<tr>"
                    + "<td width='50%' align='left'></td>"
                    + "<td width='50%' align='left'></td>"
                    + "</tr>"

                    + "<tr>"
                    + "<td width='50%' align='left'></td>"
                    + "<td width='50%' align='left'></td>"
                    + "</tr>"

                    + "<tr>"
                    + "<td width='50%' align='left'></td>"
                    + "<td width='50%' align='left'></td>"
                    + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Email Address</td>"
                     + "<td width='50%' align='left'>" + _email.ToString() + "</td>"
                     + "</tr>"

                    + "<tr>"
                    + "<td width='50%' align='left'></td>"
                    + "<td width='50%' align='left'></td>"
                    + "</tr>"

                     + "</table>"
                     + "</td>" //End 2
                     + "</tr>"

                     + "<tr>"
                     + "<td colspan='2' align='left'> At fault motor claims experiences, please provide the reason : " + _claimstatus.ToString() + "</td>"
                     + "</tr>"

                     + "<div style='display:" + _divclaimstatus + ";'>"
                     + "<tr>"
                     + "<td colspan='2'>"
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            if (claimamt1.ToString() == "0")
            {
                _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                + "<td style='width:25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _claim1ststat.ToString() + " to " + _claim1stend.ToString() + "</td>"
                + "<td style='width: 25%' align='left'> Claim Amount</td>"
                + "<td style='width: 25%' align='left'>" + claimamt1.ToString() + "</td></tr>";
            }
            if (claimamt2.ToString() == "0")
            {
                _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim2ndstat.ToString() + " to " + _claim2ndend.ToString() + "</td>"
                + "<td style='width: 25%' align='left'> Claim Amount</td>"
                + "<td style='width: 25%' align='left'>" + claimamt2.ToString() + "</td></tr>";
            }
            if (claimamt3.ToString() == "0")
            {
                _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim3rdstat.ToString() + " to " + _claim3rdend.ToString() + "</td>"
                + "<td style='width: 25%' align='left'> Claim Amount</td>"
                + "<td style='width: 25%' align='left'>" + claimamt3.ToString() + "</td></tr>";
            }
            _html += "</table>"
             + "</td>"
             + "</tr>"
             + "</div>"

             + "<tr>"
             + "<td colspan='2' align='left'>No Claim Discount(NCD) to be transferred to this insurance policy : " + _ncdstatus.ToString() + "</td>"
             + "</tr>"

             + "<tr>"
             + "<td colspan='2'>"
             + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

             + "<tr><td style='width:25%' align='left'>NCD on next renewal (%)</td>"
             + "<td style='width: 25%' align='left'>" + _ncdpercent.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Insurance Company</td>"
             + "<td style='width: 25%' align='left'>" + _inscomp.ToString() + "</td></tr>"

             + "<tr>"
             + "<td colspan='4' align='left'>If NCD is nil or 10% with no claims experiences, please provide reason : " + _ncdreson.ToString() + "</td>"
             + "</tr>"
             + "<tr><td colspan='4' align='left'></td></tr>"

             + "<tr><td colspan='4' align='left'><b>Details of motor car to be insured</b></td></tr>"

             + "<tr><td style='width:25%' align='left'>Registration No</td>"
             + "<td style='width: 25%' align='left'>" + _vehicleno.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Year of Registration</td>"
             + "<td style='width: 25%' align='left'>" + _regyear.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Make and Model</td>"
             + "<td style='width: 25%' align='left'>" + _makemodel.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Off peak car?</td>"
             + "<td style='width: 25%' align='left'>" + _offpeakcar.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Cubic capacity (CC)</td>"
             + "<td style='width: 25%' align='left'>" + _cc.ToString() + "cc</td>"
             + "<td style='width: 25%' align='left'>Engine Type</td>"
             + "<td style='width: 25%' align='left'>" + _enginetype.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Type of Body</td>"
             + "<td style='width: 25%' align='left'>" + _bodytype.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Purchase price</td>"
             + "<td style='width: 25%' align='left'>" + _purchaseprice.ToString() + "</td></tr>"

             + "<tr><td style='width:25%' align='left'>Engine Number</td>"
             + "<td style='width: 25%;mso-number-format:\' align='left'>" + _engineno.ToString() + "</td>"
             + "<td style='width: 25%' align='left'>Chassis Number</td>"
             + "<td style='width: 25%; mso-number-format:\' align='left'>" + _chassisno.ToString() + "</td></tr>"

             + "<tr>"
             + "<td colspan='2' align='left'>Name of hire purchase owner(s), if any</td>"
             + "<td colspan='2' align='left'>" + _hp.ToString() + "</td>"
             + "</tr>"
             + "<tr><td colspan='4' align='left'></td></tr>"

             + "<tr><td colspan='4' align='left'><b>Details of insurance required</b></td></tr>";

            DateTime dtStart = Convert.ToDateTime(_insstartdate);
            DateTime dtEnd = Convert.ToDateTime(_insenddate);

            _html += "<tr><td colspan='3' align='left'>Period of insurance required</td>"
             + "<td align='left'>From " + dtStart.ToShortDateString() + " To " + dtEnd.ToShortDateString() + "</td></tr>"

            //+ "<tr><td style='width:25%' align='left'>From</td>"
                //+ "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _insstartdate.ToString() + "</td>"
                //+ "<td style='width: 25%' align='left'>To midnight of</td>"
                //+ "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _insenddate.ToString() + "</td></tr>"

           + "<tr><td colspan='3' align='left'>Would the car be driven by any Young and/or Inexperienced driver (aged below 26 years and/or has a full driving license for less than 2 years) ?</td>"
           + "<td align='left'>" + IsYesNo(_isyoungdriver) + "</td></tr>"

           + "<tr><td colspan='3' align='left'>Company Registered Car</td>"
           + "<td align='left'>" + IsYesNo(_iscompanycar) + "</td></tr>"

           + "<tr><td colspan='3' align='left'>Has any insurance company ever declined your proposal, cancelled or refused to renew your policy during the last 3 years?</td>"
           + "<td align='left'>" + IsYesNo(_isdeclined) + "</td></tr>"

           + "<tr><td colspan='3' align='left'>I opt to insure with No Claim Discount Protection (Applicable to 50% NCD only)</td>"
           + "<td align='left'>" + IsYesNo(_isnoncdprotect) + "</td></tr>"

           + "<tr><td colspan='3' align='left'>I opt to insure without COE/PARF</td>"
           + "<td align='left'>" + IsYesNo(_isCOE) + "</td></tr>"

           + "<tr><td colspan='3' align='left'>  Is the car being used for social, domestic and pleasure purposes and business of proposer, proposer's employer or partner?</td>"
          + "<td align='left'>" + IsYesNo(_isSocialPurpose) + "</td></tr>"

           + "<tr><td align='left' colspan='4' ></td></tr>";


            _html += "<tr><td colspan='4' align='left'><b>Details of main driver / named driver : </b>" + _adddriver.ToString() + "</td></tr>";

            if (Convert.ToInt16(_drcount) > 0)
            {
                _html += "<tr><td colspan='4' align='left'>Driver 1</td></tr>"
                + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _drname1.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date of Birth</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob1.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Occupation</td>"
                + "<td style='width: 25%' align='left'>" + _drocc1.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Nature of Business</td>"
                + "<td style='width: 25%' align='left'>" + _drnobus1.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_drcount) > 1)
            {
                _html += "<tr><td colspan='4' align='left'>Driver 2</td></tr>"
                + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _drname2.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date of Birth</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob2.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Occupation</td>"
                + "<td style='width: 25%' align='left'>" + _drocc2.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Nature of Business</td>"
                + "<td style='width: 25%' align='left'>" + _drnobus2.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_drcount) > 2)
            {
                _html += "<tr><td colspan='4' align='left'>Driver 3</td></tr>"
                + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _drname3.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date of Birth</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob3.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Occupation</td>"
                + "<td style='width: 25%' align='left'>" + _drocc3.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Nature of Business</td>"
                + "<td style='width: 25%' align='left'>" + _drnobus3.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_drcount) > 3)
            {
                _html += "<tr><td colspan='4' align='left'>Driver 4</td></tr>"
                + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _drname4.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date of Birth</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob4.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Occupation</td>"
                + "<td style='width: 25%' align='left'>" + _drocc4.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Nature of Business</td>"
                + "<td style='width: 25%' align='left'>" + _drnobus4.ToString() + "</td></tr>";
            }
            if (Convert.ToInt16(_drcount) > 4)
            {
                _html += "<tr><td colspan='4' align='left'>Driver 5</td></tr>"
                + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                + "<td style='width: 25%' align='left'>" + _drname5.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Date of Birth</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob5.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Occupation</td>"
                + "<td style='width: 25%' align='left'>" + _drocc5.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Nature of Business</td>"
                + "<td style='width: 25%' align='left'>" + _drnobus5.ToString() + "</td></tr>";
            }
            _html += "<tr><td colspan='4' align='left'></td></tr>"
              + "<tr><td colspan='4' align='left'><b>Payment Mode : </b>Credit Card</td></tr>"
            + "<tr><td style='width:25%' align='left'>Name of the Card</td>"
            + "<td style='width: 25%' align='left'>" + _nameofcard.ToString() + "</td>"
            + "<td style='width: 25%' align='left'>Issuing Bank</td>"
            + "<td style='width: 25%' align='left'>" + _issuebank.ToString() + "</td></tr>"

            + "<tr><td style='width:25%' align='left'>Credit Card No.</td>"
            + "<td style='width: 25%' align='left'>" + _ccno.ToString() + "</td>"
            + "<td style='width: 25%' align='left'>Card expiry date</td>"
            + "<td style='width: 25%; mso-number-format:mmm\\-yyyy' align='left'>" + _ccexmm.ToString() + "/" + _ccexyy.ToString() + "</td></tr>"

            + "<tr><td style='width:25%' align='left'>Type of Card</td>"
            + "<td style='width: 25%' align='left'>" + _cctype.ToString() + "</td>"
            + "<td style='width: 25%' align='left'></td>"
            + "<td style='width: 25%' align='left'></td></tr>"

            + "</table>"
            + "</td>"
            + "</tr>"

            + "</table>"
            + "</div></div>";
        }
        return _html;
    }

    public void ExportGridView(Int64 RefID, string fileName, System.Web.UI.WebControls.Label lblContent, string headerText)
    {
        string convertno = General.GetRefNumber(RefID);

        string attachment = "attachment; filename=" + fileName + ".xls";

        Response.ClearContent();

        Response.AddHeader("content-disposition", attachment);

        Response.ContentType = "application/ms-excel";

        StringWriter sw = new StringWriter();

        HtmlTextWriter htw = new HtmlTextWriter(sw);

        // Create a form to contain the grid

        HtmlForm frm = new HtmlForm();

        frm.InnerHtml = headerText;

        lblContent.Parent.Controls.Add(frm);

        frm.Attributes["runat"] = "server";

        frm.Controls.Add(lblContent);

        frm.RenderControl(htw);

        //GridView1.RenderControl(htw);

        Response.Write(sw.ToString());

        Response.End();


        //string[] fileList = new string[1];

        //fileList[0] = fileName + ".xls";

        //if (MyMailManager.SendEmailByAttachedment("che", "cherylmae.lanot@teledirect.com.sg", "Car Insurance", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), convertno, fileList))
        //{
        //    Response.Write("Email has been sent with " + fileList.ToString());
        //}
        //else
        //{
        //    Response.Write("Email can't be sent.");
        //}
        //Response.Write("Excel Exported");

    }

    public string NoNCD(string NCD)
    {
        string _ncd = "";
        if (NCD == "0")
        {
            _ncd = "10%";
        }
        else if (NCD == "10")
        {
            _ncd = "20%";
        }
        else if (NCD == "20")
        {
            _ncd = "30%";
        }
        else if (NCD == "30")
        {
            _ncd = "40%";
        }
        else if (NCD == "40" || NCD == "50")
        {
            _ncd = "50%";
        }
        return _ncd;
    }

    public string OneTimesNCD(string NCD)
    {
        string _ncd = "";
        if (NCD == "0" || NCD == "10" || NCD == "20" || NCD == "30")
        {
            _ncd = "0%";
        }
        else if (NCD == "40")
        {
            _ncd = "10%";
        }
        else if (NCD == "50")
        {
            _ncd = "20%";
        }
        return _ncd;
    }

    private string IsYesNo(string option)
    {
        string IsYes = "Yes";

        if (option == "False")
            IsYes = "No";

        return IsYes;
    }

    #region oldLiberty
    //protected void GeneratePDFProposalForm(Int64 RefID)
    //{
    //    LibertyCarInsurancePDFOutput GeneratePDF = new LibertyCarInsurancePDFOutput();

    //    string convertno = General.GetRefNumber(RefID);
    //    string _fileName = "L" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

    //    DataSet _dsProposal = new DataSet();
    //    ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
    //    _dsProposal = _proposaldownloaddb.GetLibertyProposal(RefID, "CI");


    //    if (_dsProposal.Tables[0].Rows.Count > 0)
    //    {
    //        #region variables
    //        string _name, _unitno, _homeno, _address, _postalcode, _dob, _dd, _mm, _yy, _nationality, _nric, _maritalstatus, _officeno, _mobile;
    //        string _gender, _expdriving, _vehicleno, _make, _model, _vehicletype, _engineno, _chassisno, _cc, _regyear, _mfgyear, _hpstatus, _hpcomp;
    //        string _insstartdate, _insenddate, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _insstatus, _inscomp, _insvhleno, _insncdentitle;
    //        string _inspldate, _indd, _inmm, _inyy, _ncdreson, _bodytype, _occupation, _empname, _drwestmylsa, _vhlemodifystatus, _vhlemodifyreason;
    //        string _drname1, _drage1, _drgender1, _drmarital1, _drocc1, _drexp1, _drname2, _drage2, _drgender2, _drmarital2, _drocc2, _drexp2;
    //        string _drname3, _drage3, _drgender3, _drmarital3, _drocc3, _drexp3, _drname4, _drage4, _drgender4, _drmarital4, _drocc4, _drexp4;
    //        string _drname5, _drage5, _drgender5, _drmarital5, _drocc5, _drexp5, _demeritstatus, _demeritcount, _dmdrname1, _dmdrpoint1;
    //        string _drDOB1, _drDOB2, _drDOB3, _drDOB4, _drDOB5;
    //        string _dmdrdate1, _dmdrtype1, _dmdrname2, _dmdrpoint2, _dmdrdate2, _dmdrtype2, _dmdrname3, _dmdrpoint3, _dmdrdate3, _dmdrtype3;
    //        string _dmdrname4, _dmdrpoint4, _dmdrdate4, _dmdrtype4, _dmdrname5, _dmdrpoint5, _dmdrdate5, _dmdrtype5, _dmdrname6, _dmdrpoint6;
    //        string _dmdrdate6, _dmdrtype6, _adddriver, _drcount, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _claimstatus, _claim1ststat, _claim1stend;
    //        string _claimcount1, claimamt1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _ncdnil;
    //        string _inscancelstatus, _cancelreason, _impairstatus, _impairreason, _accessorystatus, _accessorydetail, _convictedstatus, _convictedreason, _planname, _annualpremium;
    //        string _insrefusedstatus, _refusedreason, _jobnature, _email;
    //        string _drjobnature1, _drjobnature2, _drjobnature3, _drjobnature4, _drjobnature5;

    //        DateTime _dofb, _isdate, _iedate, _indate;

    //        _email = "";
    //        _jobnature = ""; _drjobnature1 = ""; _drjobnature2 = ""; _drjobnature3 = ""; _drjobnature4 = ""; _drjobnature5 = "";
    //        _inscancelstatus = ""; _cancelreason = ""; _impairstatus = ""; _impairreason = ""; _demeritstatus = ""; _demeritcount = "";
    //        _dmdrname1 = ""; _dmdrpoint1 = ""; _dmdrdate1 = ""; _dmdrtype1 = ""; _dmdrname2 = ""; _dmdrpoint2 = ""; _dmdrdate2 = ""; _dmdrtype2 = "";
    //        _dmdrname3 = ""; _dmdrpoint3 = ""; _dmdrdate3 = ""; _dmdrtype3 = ""; _dmdrname4 = ""; _dmdrdate4 = ""; _dmdrtype4 = "";
    //        _dmdrpoint4 = ""; _dmdrname5 = ""; _dmdrpoint5 = ""; _dmdrdate5 = ""; _dmdrtype5 = ""; _dmdrname6 = "";
    //        _dmdrpoint6 = ""; _dmdrdate6 = ""; _dmdrtype6 = ""; _vehicletype = ""; _expdriving = "";
    //        _drname1 = ""; _drage1 = ""; _drgender1 = ""; _drmarital1 = ""; _drocc1 = ""; _drexp1 = "";
    //        _drname2 = ""; _drage2 = ""; _drgender2 = ""; _drmarital2 = ""; _drocc2 = ""; _drexp2 = "";
    //        _drname3 = ""; _drage3 = ""; _drgender3 = ""; _drmarital3 = ""; _drocc3 = ""; _drexp3 = "";
    //        _drname4 = ""; _drage4 = ""; _drgender4 = ""; _drmarital4 = ""; _drocc4 = ""; _drexp4 = "";
    //        _drname5 = ""; _drage5 = ""; _drgender5 = ""; _drmarital5 = ""; _drocc5 = ""; _drexp5 = ""; _planname = ""; _annualpremium = "";
    //        _adddriver = ""; _drcount = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";
    //        _insrefusedstatus = ""; _refusedreason = "";
    //        _drDOB1 = ""; _drDOB2 = ""; _drDOB3 = ""; _drDOB4 = ""; _drDOB5 = "";

    //        _name = _dsProposal.Tables[0].Rows[0]["Name"].ToString();
    //        _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
    //        _dd = _dofb.Day.ToString("00");
    //        _mm = _dofb.Month.ToString("00");
    //        _yy = _dofb.Year.ToString();
    //        //_dob = _dd + "/" + _mm + "/" + _yy;
    //        _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
    //        _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
    //        _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
    //        _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
    //        _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
    //        _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
    //        _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
    //        _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
    //        _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();
    //        _jobnature = _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
    //        _email = _dsProposal.Tables[0].Rows[0]["Email"].ToString();

    //        _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
    //        _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();

    //        _drwestmylsa = _dsProposal.Tables[0].Rows[0]["DrWMalaysia"].ToString();
    //        _expdriving = _dsProposal.Tables[0].Rows[0]["YearDriveSg"].ToString();
    //        _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString();
    //        _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
    //        _officeno = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
    //        _empname = _dsProposal.Tables[0].Rows[0]["EmpNameandTrade"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
    //        {
    //            _claimstatus = "No";
    //        }
    //        else
    //        {
    //            _claimstatus = "Yes";
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["HasPreInsurer"].ToString() == "True")
    //        {
    //            _insstatus = "Yes";
    //            if (_dsProposal.Tables[2].Rows.Count > 0)
    //            {
    //                _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();
    //                _insvhleno = _dsProposal.Tables[0].Rows[0]["PreInsVechicleNo"].ToString();
    //                _indate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString());
    //                _indd = _indate.Day.ToString("00");
    //                _inmm = _indate.Month.ToString("00");
    //                _inyy = _indate.Year.ToString();
    //                //_inspldate = _dd + "/" + _mm + "/" + _yy;
    //                _inspldate = _dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString();
    //                if (_dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() == "-1")
    //                {
    //                    _insncdentitle = "";
    //                }
    //                else
    //                {
    //                    _insncdentitle = _dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() + "%";
    //                }
    //            }
    //            else
    //            {
    //                _insstatus = "No";
    //                _inscomp = "";
    //                _insvhleno = "";
    //                _inspldate = "";
    //                _insncdentitle = "";
    //            }
    //        }
    //        else
    //        {
    //            _insstatus = "No";
    //            _inscomp = "";
    //            _insvhleno = "";
    //            _inspldate = "";
    //            _insncdentitle = "";
    //        }

    //        _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
    //        if (_ncdpercent.ToString() == "-1")
    //        {
    //            _ncdpercent = "No NCD(First Policy)";
    //        }
    //        else
    //        {
    //            _ncdpercent += "%";
    //        }
    //        _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
    //        if (_ncdreson == "Others")
    //        {
    //            _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
    //        }
    //        else if (_ncdreson == "-1")
    //        {
    //            _ncdreson = "";
    //        }
    //        if (_dsProposal.Tables[1].Rows.Count > 0)
    //        {
    //            _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
    //            _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
    //            claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
    //            _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

    //            _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
    //            _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
    //            claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

    //            _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
    //            _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
    //            claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
    //        }
    //        else
    //        {
    //            _claim1ststat = "";
    //            _claim1stend = "";
    //            claimamt1 = "";
    //            _claimcount1 = "0";

    //            _claim2ndstat = "";
    //            _claim2ndend = "";
    //            claimamt2 = "";

    //            _claim3rdstat = "";
    //            _claim3rdend = "";
    //            claimamt3 = "";
    //            _claimstatus = "No";
    //            _ncdpercent = "0%";
    //        }
    //        _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
    //        if (_ncdpercent.ToString() == "-1")
    //        {
    //            _ncdpercent = "10%";
    //        }
    //        else
    //        {
    //            if (_claimstatus == "No")
    //            {
    //                _ncdpercent = NoNCD(_ncdpercent);
    //            }
    //            else if (_claimstatus == "Yes" && _claimcount1 == "0")
    //            {
    //                _ncdpercent = NoNCD(_ncdpercent);
    //            }
    //            else if (_claimstatus == "Yes" && _claimcount1 == "1")
    //            {
    //                _ncdpercent = OneTimesNCD(_ncdpercent);
    //            }
    //            else
    //            {
    //                _ncdpercent = "0%";
    //            }
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["HasVechicleModified"].ToString() == "True")
    //        {
    //            _vhlemodifystatus = "Yes";
    //            _vhlemodifyreason = _dsProposal.Tables[0].Rows[0]["VechicleModifyReason"].ToString();
    //        }
    //        else
    //        {
    //            _vhlemodifystatus = "No";
    //            _vhlemodifyreason = "";
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString() == "True")
    //        {
    //            _inscancelstatus = "Yes";
    //            _cancelreason = _dsProposal.Tables[0].Rows[0]["InsuranceTerminatedReason"].ToString();
    //        }
    //        else
    //        {
    //            _inscancelstatus = "No";
    //            _cancelreason = "";
    //        }

    //        if (_dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString() == "True")
    //        {
    //            _impairstatus = "Yes";
    //            _impairreason = _dsProposal.Tables[0].Rows[0]["PhysicalImpairmentReason"].ToString();
    //        }
    //        else
    //        {
    //            _impairstatus = "No";
    //            _impairreason = "";
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["HasConvictedMoterOffence"].ToString() == "True")
    //        {
    //            _convictedstatus = "Yes";
    //            _convictedreason = _dsProposal.Tables[0].Rows[0]["ConvictedReason"].ToString();
    //        }
    //        else
    //        {
    //            _convictedstatus = "No";
    //            _convictedreason = "";
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["HasAccessory"].ToString() == "True")
    //        {
    //            _accessorystatus = "Yes";
    //            _accessorydetail = _dsProposal.Tables[0].Rows[0]["AccessoryDescription"].ToString();
    //        }
    //        else
    //        {
    //            _accessorystatus = "No";
    //            _accessorydetail = "";
    //        }


    //        if (_dsProposal.Tables[0].Rows[0]["Info1"].ToString() == "1")
    //        {
    //            _insrefusedstatus = "Yes";
    //            _refusedreason = _dsProposal.Tables[0].Rows[0]["Info2"].ToString();
    //        }
    //        else
    //        {
    //            _insrefusedstatus = "No";
    //            _refusedreason = "";
    //        }

    //        if (_dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString() == "True")
    //        {
    //            if (_dsProposal.Tables[6].Rows.Count > 0)
    //            {
    //                _demeritstatus = "Yes";
    //                _demeritcount = _dsProposal.Tables[6].Rows.Count.ToString();

    //                _dmdrname1 = _dsProposal.Tables[6].Rows[0]["DriverName"].ToString();
    //                _dmdrpoint1 = _dsProposal.Tables[6].Rows[0]["TotalDemeritPoints"].ToString();
    //                _dmdrdate1 = _dsProposal.Tables[6].Rows[0]["DemeritDate"].ToString();
    //                _dmdrtype1 = _dsProposal.Tables[6].Rows[0]["TypeofOffence"].ToString();
    //                if (_dsProposal.Tables[6].Rows.Count > 1)
    //                {
    //                    _dmdrname2 = _dsProposal.Tables[6].Rows[1]["DriverName"].ToString();
    //                    _dmdrpoint2 = _dsProposal.Tables[6].Rows[1]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate2 = _dsProposal.Tables[6].Rows[1]["DemeritDate"].ToString();
    //                    _dmdrtype2 = _dsProposal.Tables[6].Rows[1]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 2)
    //                {
    //                    _dmdrname3 = _dsProposal.Tables[6].Rows[2]["DriverName"].ToString();
    //                    _dmdrpoint3 = _dsProposal.Tables[6].Rows[2]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate3 = _dsProposal.Tables[6].Rows[2]["DemeritDate"].ToString();
    //                    _dmdrtype3 = _dsProposal.Tables[6].Rows[2]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 3)
    //                {
    //                    _dmdrname4 = _dsProposal.Tables[6].Rows[3]["DriverName"].ToString();
    //                    _dmdrpoint4 = _dsProposal.Tables[6].Rows[3]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate4 = _dsProposal.Tables[6].Rows[3]["DemeritDate"].ToString();
    //                    _dmdrtype4 = _dsProposal.Tables[6].Rows[3]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 4)
    //                {
    //                    _dmdrname5 = _dsProposal.Tables[6].Rows[4]["DriverName"].ToString();
    //                    _dmdrpoint5 = _dsProposal.Tables[6].Rows[4]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate5 = _dsProposal.Tables[6].Rows[4]["DemeritDate"].ToString();
    //                    _dmdrtype5 = _dsProposal.Tables[6].Rows[4]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 5)
    //                {
    //                    _dmdrname6 = _dsProposal.Tables[6].Rows[5]["DriverName"].ToString();
    //                    _dmdrpoint6 = _dsProposal.Tables[6].Rows[5]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate6 = _dsProposal.Tables[6].Rows[5]["DemeritDate"].ToString();
    //                    _dmdrtype6 = _dsProposal.Tables[6].Rows[5]["TypeofOffence"].ToString();
    //                }
    //            }
    //            else
    //            {
    //                _demeritstatus = "No";
    //                _demeritcount = "0";
    //            }
    //        }
    //        else
    //        {
    //            _demeritstatus = "No";
    //            _demeritcount = "0";
    //        }

    //        _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
    //        _mfgyear = _dsProposal.Tables[0].Rows[0]["ManufactYear"].ToString();
    //        _regyear = _dsProposal.Tables[0].Rows[0]["DateofReg"].ToString();
    //        _model = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
    //        _make = _dsProposal.Tables[5].Rows[0]["Make"].ToString();
    //        _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
    //        _vehicletype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
    //        _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
    //        _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

    //        _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
    //        _isdd = _isdate.Day.ToString("00");
    //        _ismm = _isdate.Month.ToString("00");
    //        _isyy = _isdate.Year.ToString();
    //        //_insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
    //        _insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

    //        _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
    //        _iedd = _iedate.Day.ToString("00");
    //        _iemm = _iedate.Month.ToString("00");
    //        _ieyy = _iedate.Year.ToString();
    //        //_insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
    //        _insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

    //        if (_dsProposal.Tables[3].Rows.Count > 0)
    //        {
    //            _hpstatus = "Yes";
    //            _hpcomp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

    //            if (_hpcomp.ToString() == "")
    //            {
    //                _hpcomp = "Not Applicable";
    //            }
    //        }
    //        else
    //        {
    //            _hpstatus = "No";
    //            _hpcomp = "Not Applicable";
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
    //        {
    //            _adddriver = "Yes";
    //            _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
    //        }
    //        else
    //        {
    //            _adddriver = "No";
    //            _drcount = "0";
    //        }
    //        if (_dsProposal.Tables[4].Rows.Count > 0)
    //        {
    //            if (Convert.ToInt16(_drcount) > 0)
    //            {
    //                _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
    //                _drage1 = _dsProposal.Tables[4].Rows[0]["Age"].ToString();
    //                _drgender1 = _dsProposal.Tables[4].Rows[0]["Gender"].ToString();
    //                _drmarital1 = _dsProposal.Tables[4].Rows[0]["Marital"].ToString();
    //                _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
    //                _drexp1 = _dsProposal.Tables[4].Rows[0]["YearOfDrivingInSg"].ToString();
    //                _drDOB1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
    //                _drjobnature1 = _dsProposal.Tables[4].Rows[0]["JobNature"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 1)
    //            {
    //                _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
    //                _drage2 = _dsProposal.Tables[4].Rows[1]["Age"].ToString();
    //                _drgender2 = _dsProposal.Tables[4].Rows[1]["Gender"].ToString();
    //                _drmarital2 = _dsProposal.Tables[4].Rows[1]["Marital"].ToString();
    //                _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
    //                _drexp2 = _dsProposal.Tables[4].Rows[1]["YearOfDrivingInSg"].ToString();
    //                _drDOB2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
    //                _drjobnature2 = _dsProposal.Tables[4].Rows[1]["JobNature"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 2)
    //            {
    //                _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
    //                _drage3 = _dsProposal.Tables[4].Rows[2]["Age"].ToString();
    //                _drgender3 = _dsProposal.Tables[4].Rows[2]["Gender"].ToString();
    //                _drmarital3 = _dsProposal.Tables[4].Rows[2]["Marital"].ToString();
    //                _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
    //                _drexp3 = _dsProposal.Tables[4].Rows[2]["YearOfDrivingInSg"].ToString();
    //                _drDOB3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
    //                _drjobnature3 = _dsProposal.Tables[4].Rows[2]["JobNature"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 3)
    //            {
    //                _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
    //                _drage4 = _dsProposal.Tables[4].Rows[3]["Age"].ToString();
    //                _drgender4 = _dsProposal.Tables[4].Rows[3]["Gender"].ToString();
    //                _drmarital4 = _dsProposal.Tables[4].Rows[3]["Marital"].ToString();
    //                _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
    //                _drexp4 = _dsProposal.Tables[4].Rows[3]["YearOfDrivingInSg"].ToString();
    //                _drDOB4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 4)
    //            {
    //                _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
    //                _drage5 = _dsProposal.Tables[4].Rows[4]["Age"].ToString();
    //                _drgender5 = _dsProposal.Tables[4].Rows[4]["Gender"].ToString();
    //                _drmarital5 = _dsProposal.Tables[4].Rows[4]["Marital"].ToString();
    //                _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
    //                _drexp5 = _dsProposal.Tables[4].Rows[4]["YearOfDrivingInSg"].ToString();
    //                _drDOB5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
    //                _drjobnature5 = _dsProposal.Tables[4].Rows[4]["JobNature"].ToString();
    //            }
    //        }

    //        DataSet _dsPayment = new DataSet();
    //        _dsPayment = _proposaldownloaddb.GetPaymentDetails(RefID, 29, "CI");
    //        if (_dsPayment != null && _dsPayment.Tables[0].Rows.Count > 0)
    //        {
    //            _nameofcard = _dsPayment.Tables[0].Rows[0]["NameoftheCard"].ToString();
    //            _issuebank = _dsPayment.Tables[0].Rows[0]["IssuingBankName"].ToString();
    //            _cno = _dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString();
    //            _ccexmm = _dsPayment.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
    //            _ccexyy = _dsPayment.Tables[0].Rows[0]["CardExpiryYear"].ToString();
    //            _cctype = _dsPayment.Tables[0].Rows[0]["CardType"].ToString();

    //            if (_dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString() != "")
    //                _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);
    //            else
    //                _ccno = "";
    //        }

    //        #endregion

    //        //_html = "<table><tr><td width='25%'>Plan Name</td><td>" + _planname + "</td><td colspan='2' align='right'>Annual Premium : $" + _annualpremium.ToString() + "</td></tr></table>";
    //        _html = "<table><tr><td colspan='4'> </td></tr></table>";
    //        _html += "<table><tr><td colspan='4' align='center'><b>MOTOR INSURANCE PROPOSAL</b></td></tr></table>";

    //        _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
    //                 + "<tr>"
    //                 + "<td width='50%'>" //Start 1
    //                 + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

    //                 + "<tr>"
    //                 + "<td width='50%' align='left'><b>Reference Number</b> </td>"
    //                 + "<td width='50%' align='left'>" + "L" + convertno.ToString() + "</td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td colspan='2'><b>Insured's Particulars</b></td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td width='50%' align='left'>IC/ROC Number</td>"
    //                 + "<td width='50%' align='left'>" + _nric.ToString() + "</td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td align='left' >Address</td>"
    //                 + "<td align='left'>"
    //                 + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0'>"
    //                 + "<tr><td align='left'>#" + _unitno.ToString() + " - " + _homeno.ToString() + "</td></tr>"
    //                 + "<tr><td align='left'>" + _address.ToString() + "</td></tr>"
    //                 + "<tr><td align='left'>Postal Code " + _postalcode.ToString() + "</td></tr>"
    //                 + "</table>"
    //                 + "</td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td colspan='2'> </td>"
    //                 + "</tr>"

    //                 + "</table>"
    //                 + "</td>" //End 1

    //                 + "<td width='50%'>" //Start 2
    //                 + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"


    //                 + "<tr>"
    //                 + "<td width='50%' align='left'>Date</td>"
    //                 + "<td width='50%' align='left'>" + CE.Global.General.GetUTCDateTime().ToString("dd-mm-yyyy") + "</td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td colspan='2'> </td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td width='50%' align='left'>Name</td>"
    //                 + "<td width='50%' align='left'>" + _name.ToString() + "</td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td colspan='2'> </td>"
    //                 + "</tr>"
    //                 + "<tr>"
    //                 + "<td colspan='2'> </td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td width='50%' align='left' >Mobile No./Office No.</td>"
    //                 + "<td width='50%' align='left' >" + _mobile.ToString() + " / " + _officeno.ToString() + "</td>"
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td colspan='2'> </td>"
    //                 + "</tr>"


    //                 //+ "<tr>"
    //            //+ "<td width='50%' align='left'>Nationality</td>"
    //            //+ "<td width='50%' align='left'>" + _nationality.ToString() + "</td>"
    //            //+ "</tr>"


    //                 + "</table>"
    //                 + "</td>" //End 2
    //                 + "</tr>"

    //                 + "<tr>"
    //                 + "<td colspan='2'>"
    //                 + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

    //                + "<tr>"
    //                + "<td width='50%' align='left'>Employer's Name & Trade </td>"
    //                + "<td width='50%' align='left'>" + _empname.ToString() + "</td>"
    //                + "<td width='50%' align='left'>Email Address</td>"
    //                 + "<td width='50%' align='left'>" + _email.ToString() + "</td>"
    //                + "</tr>"

    //                + "<tr>"
    //                + "<td colspan='4' align='left'> </td>"
    //                + "</tr>"

    //                + "<tr>"
    //                + "<td colspan='4' align='left' width='100%'>"
    //                + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
    //                + "<tr>"
    //                + "<td align='center' width='16%'><b>Name</b></td>"
    //                + "<td align='center' width='14%'><b>Sex</b></td>"
    //                + "<td align='center' width='14%'><b>Date of Birth</b></td>"
    //                + "<td align='center' width='14%'><b>Occupation</b></td>"
    //                + "<td align='center' width='14%'><b>Indoor/Outdoor</b></td>"
    //                + "<td align='center' width='14%'><b>Marital Status</b></td>"
    //                + "<td align='center' width='14%'><b>Driving XP(Yrs)</b></td>"
    //                + "</tr>"
    //                + "<tr>"
    //                + "<td align='center' width='16%'>" + _name.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _gender.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _dob.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _occupation.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _jobnature.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _maritalstatus.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _expdriving.ToString() + "</td>"
    //                + "</tr>";

    //        for (int i = 1; i <= Convert.ToInt16(_drcount); i++)
    //        {
    //            if (i == 1)
    //            {
    //                _html += "<tr>"
    //                + "<td align='center' width='16%'>" + _drname1.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _drgender1.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _drDOB1.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _drocc1.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _drjobnature1.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _drmarital1.ToString() + "</td>"
    //                + "<td align='center' width='14%'>" + _drexp1.ToString() + "</td>"
    //                + "</tr>";
    //            }
    //            if (i == 2)
    //            {
    //                _html += "<tr>"
    //               + "<td align='center' width='16%'>" + _drname2.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drgender2.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drDOB2.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drocc2.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drjobnature2.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drmarital2.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drexp2.ToString() + "</td>"
    //               + "</tr>";
    //            }

    //            if (i == 3)
    //            {
    //                _html += "<tr>"
    //               + "<td align='center' width='16%'>" + _drname3.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drgender3.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drDOB3.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drocc3.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drjobnature3.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drmarital3.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drexp3.ToString() + "</td>"
    //               + "</tr>";
    //            }

    //            if (i == 4)
    //            {
    //                _html += "<tr>"
    //               + "<td align='center' width='16%'>" + _drname4.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drgender4.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drDOB4.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drocc4.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drjobnature4.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drmarital4.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drexp4.ToString() + "</td>"
    //               + "</tr>";
    //            }

    //            if (i == 5)
    //            {
    //                _html += "<tr>"
    //               + "<td align='center' width='16%'>" + _drname5.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drgender5.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drDOB5.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drocc5.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drjobnature5.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drmarital5.ToString() + "</td>"
    //               + "<td align='center' width='14%'>" + _drexp5.ToString() + "</td>"
    //               + "</tr>";
    //            }

    //        }

    //        _html += "<tr>"
    //        + "<td align='center' width='16%'></td>"
    //        + "<td align='center' width='14%'></td>"
    //        + "<td align='center' width='14%'></td>"
    //        + "<td align='center' width='14%'></td>"
    //        + "<td align='center' width='14%'></td>"
    //        + "<td align='center width='14%''></td>"
    //        + "<td align='center' width='14%'></td>"
    //        + "</tr>"
    //        + "<tr>"
    //        + "<td colspan='7' align='center'></td>"
    //        + "</tr>"
    //        + "</table>"

    //        + "</td>"
    //        + "</tr>";


    //        //if (claimamt1.ToString() == "0")
    //        //{
    //        //    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
    //        //    + "<td style='width:25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _claim1ststat.ToString() + " to " + _claim1stend.ToString() + "</td>"
    //        //    + "<td style='width: 25%' align='left'> Claim Amount</td>"
    //        //    + "<td style='width: 25%' align='left'>" + claimamt1.ToString() + "</td></tr>";
    //        //}
    //        //if (claimamt2.ToString() == "0")
    //        //{
    //        //    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
    //        //    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim2ndstat.ToString() + " to " + _claim2ndend.ToString() + "</td>"
    //        //    + "<td style='width: 25%' align='left'> Claim Amount</td>"
    //        //    + "<td style='width: 25%' align='left'>" + claimamt2.ToString() + "</td></tr>";
    //        //}
    //        //if (claimamt3.ToString() == "0")
    //        //{
    //        //    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
    //        //    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim3rdstat.ToString() + " to " + _claim3rdend.ToString() + "</td>"
    //        //    + "<td style='width: 25%' align='left'> Claim Amount</td>"
    //        //    + "<td style='width: 25%' align='left'>" + claimamt3.ToString() + "</td></tr>";
    //        //}

    //        //_html += "<tr><td style='width:25%' align='left'>NCD on next renewal (%)</td>"
    //        //+ "<td colspan='3' align='left'>" + _ncdpercent.ToString() + "</td></tr>";



    //        _html += "<tr><td colspan='4' align='left'><b>Vehicle Details</b></td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Vehicle Number</td>"
    //         + "<td style='width: 25%' align='left'>" + _insvhleno.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'></td>"
    //         + "<td style='width: 25%' align='left'></td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Chassis No</td>"
    //         + "<td style='width: 25%' align='left'>" + _chassisno.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'>Body Type</td>"
    //         + "<td style='width: 25%' align='left'>" + _vehicletype.ToString() + "</td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Engine No</td>"
    //         + "<td style='width: 25%' align='left'>" + _engineno.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'></td>"
    //         + "<td style='width: 25%' align='left'></td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Make</td>"
    //         + "<td style='width: 25%' align='left'>" + _make.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'>Year of Manufacture</td>"
    //         + "<td style='width: 25%' align='left'>" + _mfgyear.ToString() + "</td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Model</td>"
    //         + "<td style='width: 25%' align='left'>" + _model.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'>Year of Registration</td>"
    //         + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _regyear.ToString() + "</td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Engine CC/Ton</td>"
    //         + "<td style='width: 25%' align='left'>" + _cc.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'></td>"
    //         + "<td style='width: 25%' align='left'></td></tr>"

    //         + "<tr><td colspan='4' align='left'><b></b></td></tr>"
    //         + "<tr><td colspan='4' align='left'><b>Claim Details</b></td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Current Insurance Co.</td>"
    //         + "<td style='width: 25%' align='left'>" + _inscomp.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'>Vehicle No.</td>"
    //         + "<td style='width: 25%' align='left'>" + _insvhleno.ToString() + "</td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Policy No</td>"
    //         + "<td style='width: 25%;></td>"
    //         + "<td style='width: 25%' align='left'>Expiry/Cancellation Date</td>"
    //            //+ "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _inspldate.ToString() + "</td></tr>"
    //         + "<td style='width: 25%; align='left'>" + _inspldate.ToString() + "</td></tr>"

    //         + "<tr><td style='width:25%' align='left'>Last 3 years claim XP</td>"
    //         + "<td style='width: 25%' align='left'>" + _claimstatus.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'>No Claims in the last 3 Years</td>"
    //         + "<td style='width: 25%' align='left'></td></tr>"

    //         + "<tr><td style='width:25%' align='left'>NCD%</td>"
    //         + "<td style='width: 25%' align='left'>" + _insncdentitle.ToString() + "</td>"
    //         + "<td style='width: 25%' align='left'>OFD</td>"
    //         + "<td style='width: 25%' align='left'></td></tr>"

    //         + "<tr><td style='width:25%' align='left'>NCD Protector</td>"
    //         + "<td style='width: 25%' align='left'></td>"
    //         + "<td style='width: 25%' align='left'></td>"
    //         + "<td style='width: 25%' align='left'></td></tr>"

    //         + "<tr><td colspan='4' align='left'></td></tr>";

    //        //+ "<tr><td style='width:25%' align='left'>Any hire purchase to your motor vehicle?</td>"
    //        //+ "<td style='width: 25%' align='left'>" + _hpstatus.ToString() + "</td>"
    //        //+ "<td style='width: 25%' align='left'>Hire Purchase Company</td>"
    //        //+ "<td style='width: 25%' align='left'>" + _hpcomp.ToString() + "</td></tr>"

    //        // + "<tr><td colspan='4' align='left'>Do you have any motor vehicle Insurance? " + _insstatus.ToString() + "</td></tr>";

    //        _html += "<tr><td colspan='4' align='left'>If NCD is NIL, Please Provide Details : " + _ncdreson.ToString() + " </td></tr>"
    //        + "<tr><td colspan='4' align='left'>Has the vehicle been modified/converted in anyway from the manufacturer's specifications? " + _vhlemodifystatus.ToString() + "</td></tr>";
    //        if (_vhlemodifystatus.ToString() == "Yes")
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>Reason</td>"
    //                 + "<td colspan'3' align='left'>" + _vhlemodifyreason.ToString() + "</td></tr>";
    //        }

    //        //_html += "<tr><td colspan='4' align='left'>Are there any additional accessories installed on the vehicle? " + _accessorystatus.ToString() + "</td></tr>";
    //        if (_vhlemodifystatus.ToString() == "Yes")
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>Accessories Details</td>"
    //                 + "<td colspan'3' align='left'>" + _accessorydetail.ToString() + "</td></tr>";
    //        }

    //        _html += "<tr><td colspan='4' align='left'> </td></tr>"
    //        + "<tr><td colspan='4' align='left'><b>Policy Details</b></td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Finance Company</td>"
    //        + "<td style='width: 25%' align='left'>" + _issuebank.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Usage</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'>Type of Cover</td>"
    //        + "<td style='width: 25%' align='left'>" + _planname + "</td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Period From </td>"
    //        + "<td style='width: 25%' align='left'>" + _insstartdate.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'>Period To</td>"
    //        + "<td style='width: 25%' align='left'>" + _insenddate + "</td></tr>"

    //        + "<tr><td colspan='4' align='left'> </td></tr>"
    //        + "<tr><td colspan='4' align='left'><b>Other Information</b></td></tr>"

    //        + "<tr><td colspan='3' align='left'>How often do you drive to West Malaysia?</td>"
    //        + "<td align='left'>" + _drwestmylsa.ToString() + "</td></tr>"

    //        + "<tr><td colspan='4' align='left'>Have you or any driver named under Section V </td></tr>"

    //        + "<tr><td colspan='3' align='left'>1) Been convicted of any motoring offence (other than parking) in the past three (3) years or have prosecutions pending? </td>"
    //        + "<td> " + _convictedstatus.ToString() + " </td></tr>";

    //        if (_convictedstatus.ToString() == "Yes")
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>Reason</td>"
    //                 + "<td colspan'3' align='left'>" + _convictedreason.ToString() + "</td></tr>";
    //        }

    //        //_html += "<tr><td colspan='4' align='left'><b>Other Information</td></tr>"

    //        _html += "<tr><td colspan='3' align='left'>20 Been given demerit points? If Yes, please state name of driver,total no of demerit points accumulated during the last 24 mths,the date and type of offence.</td>"
    //        + "<td style='width: 25%' align='left'>" + _demeritstatus.ToString() + "</td></tr>";
    //        if (Convert.ToInt16(_demeritcount) > 0)
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>1. Driver Name</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrname1.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrpoint1.ToString() + "</td></tr>"

    //            + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrtype1.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Date</td>"
    //            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate1.ToString() + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(_demeritcount) > 1)
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>2. Driver Name</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrname2.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrpoint2.ToString() + "</td></tr>"

    //            + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrtype2.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Date</td>"
    //            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate2.ToString() + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(_demeritcount) > 2)
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>3. Driver Name</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrname3.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrpoint3.ToString() + "</td></tr>"

    //            + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrtype3.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Date</td>"
    //            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate3.ToString() + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(_demeritcount) > 3)
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>4. Driver Name</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrname4.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrpoint4.ToString() + "</td></tr>"

    //            + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrtype4.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Date</td>"
    //            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate4.ToString() + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(_demeritcount) > 4)
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>5. Driver Name</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrname5.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrpoint5.ToString() + "</td></tr>"

    //            + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrtype5.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Date</td>"
    //            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate5.ToString() + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(_demeritcount) > 5)
    //        {
    //            _html += "<tr><td style='width:25%' align='left'>5. Driver Name</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrname6.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrpoint6.ToString() + "</td></tr>"

    //            + "<tr><td style='width:25%' align='left'>Type of Offence</td>"
    //            + "<td style='width: 25%' align='left'>" + _dmdrtype6.ToString() + "</td>"
    //            + "<td style='width: 25%' align='left'>Date</td>"
    //            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dmdrdate6.ToString() + "</td></tr>";
    //        }
    //        _html += "<tr><td colspan='3' align='left'>3) Suffer from defective vision or hearing, heart condition, epilepsy, diabetes or any physical or mental disability or infirmity?</td>"
    //        + "<td style='width: 25%' align='left'>" + _impairstatus.ToString() + "</td></tr>";
    //        if (_impairstatus.ToString() == "Yes")
    //        {
    //            _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
    //            + "<td colspan='3' align='left'>" + _impairreason.ToString() + "</td></tr>";
    //        }

    //        _html += "<tr><td colspan='3' align='left'>4) Been refused motor insurance at any time or subjected to special conditions?</td>"
    //              + "<td style='width: 25%' align='left'>" + _insrefusedstatus.ToString() + "</td></tr>";
    //        if (_insrefusedstatus.ToString() == "Yes")
    //        {
    //            _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
    //            + "<td colspan='3' align='left'>" + _refusedreason.ToString() + "</td></tr>";
    //        }


    //        _html += "<tr><td colspan='3' align='left'>5) Do you have any insurance terminated in the last 12 months due to a breach of any premium payment condition?</td>"
    //                + "<td style='width: 25%' align='left'>" + _inscancelstatus.ToString() + "</td></tr>";
    //        if (_inscancelstatus.ToString() == "Yes")
    //        {
    //            _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
    //            + "<td colspan='3' align='left'>" + _cancelreason.ToString() + "</td></tr>";
    //        }


    //        _html += "<tr><td colspan='4' align='left'></td></tr>"
    //            //+ "<tr><td colspan='4' align='left'><b>Payment Before Cover Warranty (Private Vehicles)</td></tr>"
    //            //+"<tr><td colspan='4' align='left'>Please note that the total premium must be paid and actually received in full by the Company (or the intermediary through whom this policy was affected) on or"
    //            //+ " before the inception date of coverage, failing which the policy shall be deemed to be automatically cancelled and no benefits whatsoever shall be payable by the"
    //            //+ " Company</td></tr>"

    //        + "<tr><td colspan='4' align='left'><b>Premium Details</b></td></tr>"
    //        + "<tr><td colspan='4' align='left'>Quotation Period</td></tr>"

    //        + "<tr><td style='width:25%' align='left'>From Date</td>"
    //        + "<td style='width: 25%' align='left'>" + _insstartdate.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'>To Date</td>"
    //        + "<td style='width: 25%' align='left'>" + _insenddate.ToString() + "</td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Annual Premium</td>"
    //        + "<td style='width: 25%' align='left'>$" + _annualpremium.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"

    //        + "<tr><td colspan='4' align='left'></td></tr>"
    //        + "<tr><td colspan='4' align='left'><b>Mode of Payment</b></td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Mode</td>"
    //        + "<td style='width: 25%' align='left'>Credit Card</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Card Type</td>"
    //        + "<td style='width: 25%' align='left'>" + _cctype.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Card Number</td>"
    //        + "<td style='width: 25%' align='left'>" + _ccno.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"

    //        + "<tr><td style='width:25%' align='left'>Card expiry date</td>"
    //        + "<td style='width: 25%; mso-number-format:mmm\\-yyyy' align='left'>" + _ccexmm.ToString() + "/" + _ccexyy.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"


    //        + "<tr><td style='width:25%' align='left'>Card Holder's Name</td>"
    //        + "<td style='width: 25%' align='left'>" + _nameofcard.ToString() + "</td>"
    //        + "<td style='width: 25%' align='left'></td>"
    //        + "<td style='width: 25%' align='left'></td></tr>"




    //        + "</table>"
    //        + "</td>"
    //        + "</tr>"

    //        + "</table>"
    //        + "</div></div>";


    //        lblContent.Text = _html;
    //        MyIO myio = new MyIO();

    //        string[] filecontent = new string[1];
    //        filecontent[0] = strText + lblContent.Text.ToString();
    //        myio.WriteNewFile(AppDomain.CurrentDomain.BaseDirectory + "car-insurance\\proposalforms\\", _fileName + ".xls", filecontent);

    //        //SEND MAIL
    //        string _providerEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_TO");
    //        string _providerCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_CC");
    //        string _providerBCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_BCC");


    //        //string _providerEmail = "cherylmae.lanot@teledirect.com.sg";
    //        string[] filelist = new string[1];
    //        string _excelfile = Server.MapPath("proposalforms/" + _fileName + ".xls");
    //        filelist[0] = _excelfile;
    //        string _refid = "H" + convertno;
    //        MyMailManager.SendCarProposalAttachment("Liberty Insurance", _providerEmail, _providerCCEmail, _providerBCCEmail, "", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), _refid, "HSBC", filelist);
    //    }

    //}


    //private string[] GeneratePDFProposalForm(Int64 RefID, Int32 UserType)
    //{
    //    string[] filelist = new string[1];

    //    LibertyCarInsurancePDFOutput GeneratePDF = new LibertyCarInsurancePDFOutput();

    //    string convertno = General.GetRefNumber(RefID);
    //    string _fileName = "L" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

    //    DataSet _dsProposal = new DataSet();
    //    ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
    //    _dsProposal = _proposaldownloaddb.GetLibertyProposal(RefID, "CI");


    //    if (_dsProposal.Tables[0].Rows.Count > 0)
    //    {
    //        GeneratePDF.ClearFields();
    //        #region variables
    //        string _name, _unitno, _homeno, _address, _postalcode, _dob, _dd, _mm, _yy, _nationality, _nric, _maritalstatus, _officeno, _mobile;
    //        string _gender, _expdriving, _vehicleno, _make, _model, _vehicletype, _engineno, _chassisno, _cc, _regyear, _mfgyear, _hpstatus, _hpcomp;
    //        string _insstartdate, _insenddate, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _insstatus, _inscomp, _insvhleno, _insncdentitle;
    //        string _inspldate, _indd, _inmm, _inyy, _ncdreson, _bodytype, _occupation, _empname, _drwestmylsa, _vhlemodifystatus, _vhlemodifyreason;
    //        string _drname1, _drage1, _drgender1, _drmarital1, _drocc1, _drexp1, _drname2, _drage2, _drgender2, _drmarital2, _drocc2, _drexp2;
    //        string _drname3, _drage3, _drgender3, _drmarital3, _drocc3, _drexp3, _drname4, _drage4, _drgender4, _drmarital4, _drocc4, _drexp4;
    //        string _drname5, _drage5, _drgender5, _drmarital5, _drocc5, _drexp5, _demeritstatus, _demeritcount, _dmdrname1, _dmdrpoint1;
    //        string _drDOB1, _drDOB2, _drDOB3, _drDOB4, _drDOB5;
    //        string _dmdrdate1, _dmdrtype1, _dmdrname2, _dmdrpoint2, _dmdrdate2, _dmdrtype2, _dmdrname3, _dmdrpoint3, _dmdrdate3, _dmdrtype3;
    //        string _dmdrname4, _dmdrpoint4, _dmdrdate4, _dmdrtype4, _dmdrname5, _dmdrpoint5, _dmdrdate5, _dmdrtype5, _dmdrname6, _dmdrpoint6;
    //        string _dmdrdate6, _dmdrtype6, _adddriver, _drcount, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _claimstatus, _claim1ststat, _claim1stend;
    //        string _claimcount1, claimamt1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _ncdnil;
    //        string _inscancelstatus, _cancelreason, _impairstatus, _impairreason, _accessorystatus, _accessorydetail, _convictedstatus, _convictedreason, _planname, _annualpremium;
    //        string _insrefusedstatus, _refusedreason, _jobnature, _email, _ncdexisting, _claimcount;
    //        string _drjobnature1, _drjobnature2, _drjobnature3, _drjobnature4, _drjobnature5;
    //        int _excess, _cxcovertypeid;
    //        bool _isncdprotect = false;
    //        bool _isOFD = false;
    //        DateTime _dofb, _isdate, _iedate, _indate;

    //        _email = ""; _mfgyear = "1990"; _regyear = "1990"; _cc = "1111"; _ncdexisting = "0"; _claimcount = "0";
    //        _jobnature = ""; _drjobnature1 = ""; _drjobnature2 = ""; _drjobnature3 = ""; _drjobnature4 = ""; _drjobnature5 = "";
    //        _inscancelstatus = "false"; _cancelreason = ""; _impairstatus = "false"; _impairreason = ""; _demeritstatus = "false"; _demeritcount = "";
    //        _dmdrname1 = ""; _dmdrpoint1 = ""; _dmdrdate1 = ""; _dmdrtype1 = ""; _dmdrname2 = ""; _dmdrpoint2 = ""; _dmdrdate2 = ""; _dmdrtype2 = "";
    //        _dmdrname3 = ""; _dmdrpoint3 = ""; _dmdrdate3 = ""; _dmdrtype3 = ""; _dmdrname4 = ""; _dmdrdate4 = ""; _dmdrtype4 = "";
    //        _dmdrpoint4 = ""; _dmdrname5 = ""; _dmdrpoint5 = ""; _dmdrdate5 = ""; _dmdrtype5 = ""; _dmdrname6 = "";
    //        _dmdrpoint6 = ""; _dmdrdate6 = ""; _dmdrtype6 = ""; _vehicletype = ""; _expdriving = "0";
    //        _drname1 = ""; _drage1 = ""; _drgender1 = ""; _drmarital1 = ""; _drocc1 = ""; _drexp1 = "0";
    //        _drname2 = ""; _drage2 = ""; _drgender2 = ""; _drmarital2 = ""; _drocc2 = ""; _drexp2 = "0";
    //        _drname3 = ""; _drage3 = ""; _drgender3 = ""; _drmarital3 = ""; _drocc3 = ""; _drexp3 = "0";
    //        _drname4 = ""; _drage4 = ""; _drgender4 = ""; _drmarital4 = ""; _drocc4 = ""; _drexp4 = "0";
    //        _drname5 = ""; _drage5 = ""; _drgender5 = ""; _drmarital5 = ""; _drocc5 = ""; _drexp5 = "0"; _planname = ""; _annualpremium = "0";
    //        _adddriver = ""; _drcount = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";
    //        _insrefusedstatus = "false"; _refusedreason = ""; _excess = 0;
    //        _drDOB1 = "01/01/1980"; _drDOB2 = "01/01/1980"; _drDOB3 = "01/01/1980"; _drDOB4 = "01/01/1980"; _drDOB5 = "01/01/1980";
    //        _inspldate = "01/01/1980"; _cxcovertypeid = 0;

    //        _name = _dsProposal.Tables[0].Rows[0]["Name"].ToString();
    //        _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
    //        _dd = _dofb.Day.ToString("00");
    //        _mm = _dofb.Month.ToString("00");
    //        _yy = _dofb.Year.ToString();
    //        //_dob = _dd + "/" + _mm + "/" + _yy;
    //        _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
    //        _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
    //        _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
    //        _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
    //        _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
    //        _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
    //        _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
    //        _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
    //        _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();
    //        _jobnature = _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
    //        _email = _dsProposal.Tables[0].Rows[0]["Email"].ToString();
    //        _cxcovertypeid = Convert.ToInt32(_dsProposal.Tables[0].Rows[0]["CXCoverTypeId"].ToString());

    //        _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
    //        _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();
    //        _excess = int.Parse(_dsProposal.Tables[0].Rows[0]["Excess"].ToString());

    //        _drwestmylsa = _dsProposal.Tables[0].Rows[0]["DrWMalaysia"].ToString();
    //        _expdriving = _dsProposal.Tables[0].Rows[0]["YearDriveSg"].ToString();
    //        _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString();
    //        _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
    //        _officeno = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
    //        _empname = _dsProposal.Tables[0].Rows[0]["EmpNameandTrade"].ToString();
    //        _isOFD = Convert.ToBoolean(_dsProposal.Tables[0].Rows[0]["IsOffDriveCom"]);

    //        if (_dsProposal.Tables[0].Rows[0]["Info3"] != null && _dsProposal.Tables[0].Rows[0]["Info3"].ToString() != "")
    //            if (_dsProposal.Tables[0].Rows[0]["Info3"].ToString() == "1")
    //                _isncdprotect = true;
    //            else
    //                _isncdprotect = false;

    //        if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
    //        {
    //            _claimstatus = "No";
    //        }
    //        else
    //        {
    //            _claimstatus = "Yes";
    //            _claimcount = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["HasPreInsurer"].ToString() == "True")
    //        {
    //            _insstatus = "Yes";
    //            if (_dsProposal.Tables[2].Rows.Count > 0)
    //            {
    //                _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();
    //                _insvhleno = _dsProposal.Tables[0].Rows[0]["PreInsVechicleNo"].ToString();
    //                _indate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString());
    //                _indd = _indate.Day.ToString("00");
    //                _inmm = _indate.Month.ToString("00");
    //                _inyy = _indate.Year.ToString();
    //                //_inspldate = _dd + "/" + _mm + "/" + _yy;
    //                _inspldate = _dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString();
    //                if (_dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() == "-1")
    //                {
    //                    _insncdentitle = "false";
    //                }
    //                else
    //                {
    //                    _insncdentitle = _dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() + "%";
    //                }
    //            }
    //            else
    //            {
    //                _insstatus = "false";
    //                _inscomp = "";
    //                _insvhleno = "";
    //                _inspldate = "01/01/1990";
    //                _insncdentitle = "false";
    //            }
    //        }
    //        else
    //        {
    //            _insstatus = "false";
    //            _inscomp = "";
    //            _insvhleno = "";
    //            _inspldate = "1/1/1990";
    //            _insncdentitle = "false";
    //        }

    //        _ncdexisting = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
    //        _ncdpercent = _dsProposal.Tables[0].Rows[0]["NextNCD"].ToString();

    //        _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
    //        if (_ncdreson == "Others")
    //        {
    //            _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
    //        }
    //        else if (_ncdreson == "-1")
    //        {
    //            _ncdreson = "";
    //        }
    //        if (_dsProposal.Tables[1].Rows.Count > 0)
    //        {
    //            _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
    //            _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
    //            claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
    //            _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

    //            _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
    //            _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
    //            claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

    //            _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
    //            _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
    //            claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
    //        }
    //        else
    //        {
    //            _claim1ststat = "";
    //            _claim1stend = "";
    //            claimamt1 = "";
    //            _claimcount1 = "0";

    //            _claim2ndstat = "";
    //            _claim2ndend = "";
    //            claimamt2 = "";

    //            _claim3rdstat = "";
    //            _claim3rdend = "";
    //            claimamt3 = "";
    //            _claimstatus = "No";

    //        }


    //        _vhlemodifystatus = _dsProposal.Tables[0].Rows[0]["HasVechicleModified"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["HasVechicleModified"].ToString() == "True")
    //        {
    //            _vhlemodifyreason = _dsProposal.Tables[0].Rows[0]["VechicleModifyReason"].ToString();
    //        }
    //        else
    //        {
    //            _vhlemodifyreason = "";
    //        }
    //        _inscancelstatus = _dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString() == "True")
    //        {
    //            _cancelreason = _dsProposal.Tables[0].Rows[0]["InsuranceTerminatedReason"].ToString();
    //        }
    //        else
    //        {
    //            _cancelreason = "";
    //        }
    //        _impairstatus = _dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString() == "True")
    //        {
    //            _impairreason = _dsProposal.Tables[0].Rows[0]["PhysicalImpairmentReason"].ToString();
    //        }
    //        else
    //        {
    //            _impairreason = "";
    //        }

    //        _convictedstatus = _dsProposal.Tables[0].Rows[0]["HasConvictedMoterOffence"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["HasConvictedMoterOffence"].ToString() == "True")
    //        {
    //            _convictedreason = _dsProposal.Tables[0].Rows[0]["ConvictedReason"].ToString();
    //        }
    //        else
    //        {
    //            _convictedreason = "";
    //        }

    //        _accessorystatus = _dsProposal.Tables[0].Rows[0]["HasAccessory"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["HasAccessory"].ToString() == "True")
    //        {
    //            _accessorydetail = _dsProposal.Tables[0].Rows[0]["AccessoryDescription"].ToString();
    //        }
    //        else
    //        {
    //            _accessorydetail = "";
    //        }

    //        if (_dsProposal.Tables[0].Rows[0]["Info1"].ToString() == "1")
    //        {
    //            _insrefusedstatus = "true";
    //            _refusedreason = _dsProposal.Tables[0].Rows[0]["Info2"].ToString();
    //        }
    //        else
    //        {
    //            _insrefusedstatus = "false";
    //            _refusedreason = "";
    //        }

    //        _demeritstatus = _dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString();
    //        if (_dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString() == "True")
    //        {
    //            if (_dsProposal.Tables[6].Rows.Count > 0)
    //            {
    //                _demeritcount = _dsProposal.Tables[6].Rows.Count.ToString();

    //                _dmdrname1 = _dsProposal.Tables[6].Rows[0]["DriverName"].ToString();
    //                _dmdrpoint1 = _dsProposal.Tables[6].Rows[0]["TotalDemeritPoints"].ToString();
    //                _dmdrdate1 = _dsProposal.Tables[6].Rows[0]["DemeritDate"].ToString();
    //                _dmdrtype1 = _dsProposal.Tables[6].Rows[0]["TypeofOffence"].ToString();
    //                if (_dsProposal.Tables[6].Rows.Count > 1)
    //                {
    //                    _dmdrname2 = _dsProposal.Tables[6].Rows[1]["DriverName"].ToString();
    //                    _dmdrpoint2 = _dsProposal.Tables[6].Rows[1]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate2 = _dsProposal.Tables[6].Rows[1]["DemeritDate"].ToString();
    //                    _dmdrtype2 = _dsProposal.Tables[6].Rows[1]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 2)
    //                {
    //                    _dmdrname3 = _dsProposal.Tables[6].Rows[2]["DriverName"].ToString();
    //                    _dmdrpoint3 = _dsProposal.Tables[6].Rows[2]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate3 = _dsProposal.Tables[6].Rows[2]["DemeritDate"].ToString();
    //                    _dmdrtype3 = _dsProposal.Tables[6].Rows[2]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 3)
    //                {
    //                    _dmdrname4 = _dsProposal.Tables[6].Rows[3]["DriverName"].ToString();
    //                    _dmdrpoint4 = _dsProposal.Tables[6].Rows[3]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate4 = _dsProposal.Tables[6].Rows[3]["DemeritDate"].ToString();
    //                    _dmdrtype4 = _dsProposal.Tables[6].Rows[3]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 4)
    //                {
    //                    _dmdrname5 = _dsProposal.Tables[6].Rows[4]["DriverName"].ToString();
    //                    _dmdrpoint5 = _dsProposal.Tables[6].Rows[4]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate5 = _dsProposal.Tables[6].Rows[4]["DemeritDate"].ToString();
    //                    _dmdrtype5 = _dsProposal.Tables[6].Rows[4]["TypeofOffence"].ToString();
    //                }
    //                if (_dsProposal.Tables[6].Rows.Count > 5)
    //                {
    //                    _dmdrname6 = _dsProposal.Tables[6].Rows[5]["DriverName"].ToString();
    //                    _dmdrpoint6 = _dsProposal.Tables[6].Rows[5]["TotalDemeritPoints"].ToString();
    //                    _dmdrdate6 = _dsProposal.Tables[6].Rows[5]["DemeritDate"].ToString();
    //                    _dmdrtype6 = _dsProposal.Tables[6].Rows[5]["TypeofOffence"].ToString();
    //                }
    //            }
    //            else
    //            {
    //                _demeritstatus = "false";
    //                _demeritcount = "0";
    //            }
    //        }
    //        else
    //        {
    //            _demeritstatus = "false";
    //            _demeritcount = "0";
    //        }

    //        _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
    //        _mfgyear = _dsProposal.Tables[0].Rows[0]["ManufactYear"].ToString();
    //        _regyear = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DateofReg"]).Year.ToString();
    //        _model = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
    //        _make = _dsProposal.Tables[5].Rows[0]["Make"].ToString();
    //        _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
    //        _vehicletype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
    //        _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
    //        _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

    //        _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
    //        _isdd = _isdate.Day.ToString("00");
    //        _ismm = _isdate.Month.ToString("00");
    //        _isyy = _isdate.Year.ToString();
    //        //_insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
    //        _insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

    //        _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
    //        _iedd = _iedate.Day.ToString("00");
    //        _iemm = _iedate.Month.ToString("00");
    //        _ieyy = _iedate.Year.ToString();
    //        //_insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
    //        _insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

    //        if (_dsProposal.Tables[3].Rows.Count > 0)
    //        {
    //            _hpstatus = "false";
    //            _hpcomp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

    //            if (_hpcomp.ToString() == "")
    //            {
    //                _hpcomp = "Not Applicable";
    //            }
    //        }
    //        else
    //        {
    //            _hpstatus = "false";
    //            _hpcomp = "Not Applicable";
    //        }
    //        if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
    //        {
    //            _adddriver = "true";
    //            _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
    //        }
    //        else
    //        {
    //            _adddriver = "false";
    //            _drcount = "0";
    //        }
    //        if (_dsProposal.Tables[4].Rows.Count > 0)
    //        {
    //            if (Convert.ToInt16(_drcount) > 0)
    //            {
    //                _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
    //                _drage1 = _dsProposal.Tables[4].Rows[0]["Age"].ToString();
    //                _drgender1 = _dsProposal.Tables[4].Rows[0]["Gender"].ToString();
    //                _drmarital1 = _dsProposal.Tables[4].Rows[0]["Marital"].ToString();
    //                _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
    //                _drexp1 = _dsProposal.Tables[4].Rows[0]["YearOfDrivingInSg"].ToString();
    //                _drDOB1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
    //                _drjobnature1 = _dsProposal.Tables[4].Rows[0]["JobNature"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 1)
    //            {
    //                _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
    //                _drage2 = _dsProposal.Tables[4].Rows[1]["Age"].ToString();
    //                _drgender2 = _dsProposal.Tables[4].Rows[1]["Gender"].ToString();
    //                _drmarital2 = _dsProposal.Tables[4].Rows[1]["Marital"].ToString();
    //                _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
    //                _drexp2 = _dsProposal.Tables[4].Rows[1]["YearOfDrivingInSg"].ToString();
    //                _drDOB2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
    //                _drjobnature2 = _dsProposal.Tables[4].Rows[1]["JobNature"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 2)
    //            {
    //                _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
    //                _drage3 = _dsProposal.Tables[4].Rows[2]["Age"].ToString();
    //                _drgender3 = _dsProposal.Tables[4].Rows[2]["Gender"].ToString();
    //                _drmarital3 = _dsProposal.Tables[4].Rows[2]["Marital"].ToString();
    //                _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
    //                _drexp3 = _dsProposal.Tables[4].Rows[2]["YearOfDrivingInSg"].ToString();
    //                _drDOB3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
    //                _drjobnature3 = _dsProposal.Tables[4].Rows[2]["JobNature"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 3)
    //            {
    //                _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
    //                _drage4 = _dsProposal.Tables[4].Rows[3]["Age"].ToString();
    //                _drgender4 = _dsProposal.Tables[4].Rows[3]["Gender"].ToString();
    //                _drmarital4 = _dsProposal.Tables[4].Rows[3]["Marital"].ToString();
    //                _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
    //                _drexp4 = _dsProposal.Tables[4].Rows[3]["YearOfDrivingInSg"].ToString();
    //                _drDOB4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
    //            }
    //            if (Convert.ToInt16(_drcount) > 4)
    //            {
    //                _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
    //                _drage5 = _dsProposal.Tables[4].Rows[4]["Age"].ToString();
    //                _drgender5 = _dsProposal.Tables[4].Rows[4]["Gender"].ToString();
    //                _drmarital5 = _dsProposal.Tables[4].Rows[4]["Marital"].ToString();
    //                _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
    //                _drexp5 = _dsProposal.Tables[4].Rows[4]["YearOfDrivingInSg"].ToString();
    //                _drDOB5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
    //                _drjobnature5 = _dsProposal.Tables[4].Rows[4]["JobNature"].ToString();
    //            }
    //        }

    //        DataSet _dsPayment = new DataSet();
    //        _dsPayment = _proposaldownloaddb.GetPaymentDetails(RefID, 29, "CI");
    //        if (_dsPayment != null && _dsPayment.Tables[0].Rows.Count > 0)
    //        {
    //            _nameofcard = _dsPayment.Tables[0].Rows[0]["NameoftheCard"].ToString();
    //            _issuebank = _dsPayment.Tables[0].Rows[0]["IssuingBankName"].ToString();
    //            _cno = _dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString();
    //            _ccexmm = _dsPayment.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
    //            _ccexyy = _dsPayment.Tables[0].Rows[0]["CardExpiryYear"].ToString();
    //            _cctype = _dsPayment.Tables[0].Rows[0]["CardType"].ToString();

    //            if (_dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString() != "")
    //                _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);
    //            else
    //                _ccno = "";

    //        }
    //        #endregion

    //        GeneratePDF.CxCoverTypeId = _cxcovertypeid;
    //        GeneratePDF.ProposalNo = ""; // "L" + convertno;
    //        GeneratePDF.QuotationNo = "L" + convertno;
    //        GeneratePDF.ApplicationDate = CE.Global.General.GetUTCDateTime();
    //        GeneratePDF.NRIC = _nric;
    //        GeneratePDF.CustomerName = _name;
    //        GeneratePDF.CustomerAddress = _address;
    //        GeneratePDF.CustomerUnitNo = _unitno;
    //        GeneratePDF.CustomerHomeNo = _homeno;
    //        GeneratePDF.CustomerPostCode = _postalcode;
    //        GeneratePDF.MobileNo = _mobile;
    //        GeneratePDF.OfficeNo = _officeno;
    //        //GeneratePDF.OfficeMobileNo = _mobile + "/" + _officeno;
    //        GeneratePDF.EmployersName = _empname;
    //        GeneratePDF.EmailAddress = _email;
    //        GeneratePDF.CustomerDOB = Convert.ToDateTime(_dob);
    //        GeneratePDF.CustomerGender = _gender;
    //        GeneratePDF.CustomerOccupation = _occupation;
    //        GeneratePDF.CustomerJobNature = _jobnature;
    //        GeneratePDF.CustomerMaritalStatus = _maritalstatus;
    //        GeneratePDF.CustomerDrivingExperience = int.Parse(_expdriving);

    //        GeneratePDF.Driver1Name = _drname1;
    //        GeneratePDF.Driver1gender = _drgender1;
    //        GeneratePDF.Driver1DOB = Convert.ToDateTime(_drDOB1);
    //        GeneratePDF.Driver1Occupation = _drocc1;
    //        GeneratePDF.Driver1JobNature = _drjobnature1;
    //        GeneratePDF.Driver1MaritalStatus = _drmarital1;
    //        GeneratePDF.Driver1DrivingExperience = int.Parse(_drexp1);

    //        GeneratePDF.Driver2Name = _drname2;
    //        GeneratePDF.Driver2gender = _drgender2;
    //        GeneratePDF.Driver2DOB = Convert.ToDateTime(_drDOB2);
    //        GeneratePDF.Driver2Occupation = _drocc2;
    //        GeneratePDF.Driver2JobNature = _drjobnature2;
    //        GeneratePDF.Driver2MaritalStatus = _drmarital2;
    //        GeneratePDF.Driver2DrivingExperience = int.Parse(_drexp2);

    //        GeneratePDF.Driver3Name = _drname3;
    //        GeneratePDF.Driver3gender = _drgender3;
    //        GeneratePDF.Driver3DOB = Convert.ToDateTime(_drDOB3);
    //        GeneratePDF.Driver3Occupation = _drocc3;
    //        GeneratePDF.Driver3JobNature = _drjobnature3;
    //        GeneratePDF.Driver3MaritalStatus = _drmarital3;
    //        GeneratePDF.Driver3DrivingExperience = int.Parse(_drexp3);

    //        GeneratePDF.Driver4Name = _drname4;
    //        GeneratePDF.Driver4gender = _drgender4;
    //        GeneratePDF.Driver4DOB = Convert.ToDateTime(_drDOB4);
    //        GeneratePDF.Driver4Occupation = _drocc4;
    //        GeneratePDF.Driver4JobNature = _drjobnature4;
    //        GeneratePDF.Driver4MaritalStatus = _drmarital4;
    //        GeneratePDF.Driver4DrivingExperience = int.Parse(_drexp4);

    //        GeneratePDF.Driver5Name = _drname5;
    //        GeneratePDF.Driver5gender = _drgender5;
    //        GeneratePDF.Driver5DOB = Convert.ToDateTime(_drDOB5);
    //        GeneratePDF.Driver5Occupation = _drocc5;
    //        GeneratePDF.Driver5JobNature = _drjobnature5;
    //        GeneratePDF.Driver5MaritalStatus = _drmarital5;
    //        GeneratePDF.Driver5DrivingExperience = int.Parse(_drexp5);

    //        GeneratePDF.VehicleNo = _vehicleno;
    //        GeneratePDF.ChassisNo = _chassisno;
    //        GeneratePDF.EngineNo = _engineno;
    //        GeneratePDF.BodyType = _vehicletype;
    //        GeneratePDF.CarMake = _make;

    //        string modelonly = "";

    //        if ((_make.ToLower() == "alfa romeo") || (_make.ToLower() == "land rover"))
    //        {
    //            modelonly = _model.Substring(11);
    //        }
    //        else if (_make.ToLower() == "mercedes benz")
    //        {
    //            modelonly = _model.Substring(12);
    //        }
    //        else
    //        {
    //            int spacecheck = _model.IndexOf(" ") + 1;
    //            modelonly = _model.Substring(spacecheck);
    //        }

    //        GeneratePDF.CarModel = modelonly;
    //        GeneratePDF.YearOfManufacture = int.Parse(_mfgyear);
    //        GeneratePDF.YearOfRegistration = int.Parse(_regyear);
    //        GeneratePDF.CarSeaters = 0;
    //        GeneratePDF.CarCC = int.Parse(_cc);
    //        GeneratePDF.OdometerReading = "";
    //        GeneratePDF.EstimatedMarketValue = "";

    //        GeneratePDF.CurrentInsuranceCo = _inscomp;
    //        GeneratePDF.PolicyNo = "";
    //        GeneratePDF.ExpiryCancellationDate = Convert.ToDateTime(_inspldate);
    //        GeneratePDF.Last3YearsClaimXP = _claimstatus;
    //        GeneratePDF.NoClaimsLast3Years = _claimcount;

    //        //if (_ncdpercent == "-1")
    //        //    GeneratePDF.NCDPercent = "No NCD(first policy)";
    //        //else
    //        GeneratePDF.NCDPercent = _ncdpercent;

    //        GeneratePDF.NCDNilDetails = _ncdreson;

    //        GeneratePDF.IsCarModified = bool.Parse(_vhlemodifystatus);
    //        GeneratePDF.ModifiedReason = _vhlemodifyreason;

    //        GeneratePDF.FinanceCo = _hpcomp;
    //        GeneratePDF.ConvictedReason = _convictedreason;
    //        //GeneratePDF.PeriodFrom = Convert.ToDateTime(_insstartdate);
    //        //GeneratePDF.PeriodTo = Convert.ToDateTime(_insenddate);
    //        GeneratePDF.PeriodFrom = Convert.ToDateTime(_insstartdate);
    //        GeneratePDF.PeriodTo = Convert.ToDateTime(_insenddate);
    //        GeneratePDF.TypeOfCover = _planname;

    //        GeneratePDF.DriveToWestMalaysia = _drwestmylsa;
    //        GeneratePDF.IsConvictedOfMotoringOffense = bool.Parse(_convictedstatus);
    //        GeneratePDF.ConvictedReason = _convictedreason;
    //        GeneratePDF.IsGivenDemeritPoints = bool.Parse(_demeritstatus);

    //        if (_dmdrtype6 != "")
    //        {
    //            GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3 + ", " + _dmdrtype4 + ", " + _dmdrtype5 + ", " + _dmdrtype6;
    //        }
    //        else if (_dmdrtype5 != "")
    //        {
    //            GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3 + ", " + _dmdrtype4 + ", " + _dmdrtype5;
    //        }
    //        else if (_dmdrtype4 != "")
    //        {
    //            GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3 + ", " + _dmdrtype4;
    //        }
    //        else if (_dmdrtype3 != "")
    //        {
    //            GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3;
    //        }
    //        else if (_dmdrtype2 != "")
    //        {
    //            GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2;
    //        }
    //        else if (_dmdrtype1 != "")
    //        {
    //            GeneratePDF.DemeritPointsReason = _dmdrtype1;
    //        }

    //        GeneratePDF.isDisabled = Convert.ToBoolean(_impairstatus);
    //        GeneratePDF.DisablityReason = _impairreason;

    //        GeneratePDF.IsRefusedMotorInsurance = Convert.ToBoolean(_insrefusedstatus);
    //        GeneratePDF.RefusedReason = _refusedreason;

    //        GeneratePDF.IsTerminatedDueToPayment = Convert.ToBoolean(_inscancelstatus);
    //        GeneratePDF.TerminatedReason = _cancelreason;

    //        GeneratePDF.TotalPremium = float.Parse(_annualpremium);

    //        if (_cxcovertypeid == 5)
    //        {
    //            GeneratePDF.TotalPremium += 321;
    //        }

    //        GeneratePDF.Excess = _excess;

    //        double grosspremium = 0;
    //        double gstrate = 0;
    //        double ofdrate = 0;
    //        double adddiscrate = 0;
    //        double ncdrate = 0;
    //        double basicpremium = 0;
    //        double ncdprotectrate = 0;
    //        double additionaldriverrate = 0;

    //        //if (_drcount != "0")
    //        //{
    //        //    additionaldriverrate = (25 * int.Parse(_drcount)) * 1.07;
    //        //}

    //        GeneratePDF.AdditionalDriverCharge = float.Parse(additionaldriverrate.ToString());

    //        gstrate = (GeneratePDF.TotalPremium) / 107 * 7;
    //        grosspremium = (GeneratePDF.TotalPremium) / 107 * 100;

    //        GeneratePDF.GSTRate = float.Parse(gstrate.ToString());
    //        GeneratePDF.GrossPremium = float.Parse(grosspremium.ToString());

    //        if (_isOFD)
    //            GeneratePDF.OFD = "Yes";
    //        else
    //            GeneratePDF.OFD = "No";

    //        if (_isncdprotect)
    //            GeneratePDF.NCDProtector = "Yes";
    //        else
    //            GeneratePDF.NCDProtector = "No";

    //        if (_isncdprotect)
    //        {
    //            ncdprotectrate = (GeneratePDF.GrossPremium / 110) * 10;
    //        }

    //        if (_isOFD && Convert.ToInt32(_ncdpercent) >= 30)
    //        {
    //            ofdrate = (GeneratePDF.GrossPremium - ncdprotectrate) / 95 * 5;
    //        }

    //        //if (_ncdpercent == "10" || _ncdpercent == "20" || _ncdpercent == "30")
    //        //{
    //        //    adddiscrate = (GeneratePDF.GrossPremium - ncdprotectrate) / 95 * 5;
    //        //}

    //        if (_ncdpercent == "0" || _ncdpercent == "-1")
    //        {
    //            ncdrate = 0;
    //            basicpremium = GeneratePDF.GrossPremium;
    //        }

    //        else if (_ncdpercent == "10")
    //        {
    //            ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 90 * 10;
    //            basicpremium = (ncdrate / 10) * 100;
    //        }
    //        else if (_ncdpercent == "20")
    //        {
    //            ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 80 * 20;
    //            basicpremium = (ncdrate / 20) * 100;
    //        }
    //        else if (_ncdpercent == "30")
    //        {
    //            ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 70 * 30;
    //            basicpremium = (ncdrate / 30) * 100;
    //        }
    //        else if (_ncdpercent == "40")
    //        {
    //            ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 60 * 40;
    //            basicpremium = (ncdrate / 40) * 100;
    //        }
    //        else if (_ncdpercent == "50")
    //        {
    //            ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 50 * 50;
    //            basicpremium = (ncdrate / 50) * 100;
    //        }


    //        GeneratePDF.OFDRate = float.Parse(ofdrate.ToString());
    //        //GeneratePDF.AddDiscountRate = float.Parse(adddiscrate.ToString());
    //        if (_cxcovertypeid == 5)
    //        {
    //            GeneratePDF.TotalPremium -= 321;
    //            GeneratePDF.BuyUpDownRate = 321;
    //        }
    //        else
    //        {
    //            GeneratePDF.BuyUpDownRate = 0;
    //        }
    //        GeneratePDF.NCDDiscountRate = float.Parse(ncdrate.ToString());
    //        GeneratePDF.NCDProtectorRate = float.Parse(ncdprotectrate.ToString());
    //        GeneratePDF.BasicPremium = float.Parse(basicpremium.ToString());

    //        GeneratePDF.CardType = _cctype;
    //        GeneratePDF.CardNo = _ccno;
    //        //GeneratePDF.CardExpiryDate = Convert.ToDateTime("01-" + _ccexmm + "-" + _ccexyy);
    //        GeneratePDF.CardExpiryDate = Convert.ToDateTime(_ccexmm + "-" + "01" + "-" + _ccexyy);
    //        GeneratePDF.CardholdersName = _nameofcard;




    //        if (UserType == 0)
    //            GeneratePDF.LibertyPDFProposalForm(_fileName + "-cust", UserType);
    //        else
    //            GeneratePDF.LibertyPDFProposalForm(_fileName, UserType);


    //        //SEND MAIL
    //        //string _providerEmail = "cherylmae.lanot@teledirect.com.sg"; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_TO");
    //        //string _providerCCEmail = ""; //CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_CC");
    //        //string _providerBCCEmail = ""; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_BCC");

    //        string _filePath = GeneratePDF.GetFilePathLiberty();

    //        string _pdffile = _filePath + _fileName + ".pdf";

    //        if (UserType == 0)
    //            _pdffile = _filePath + _fileName + "-cust.pdf";


    //        //string _pdffile = Server.MapPath("/pdfoutput/" + _fileName + ".pdf");
    //        filelist[0] = _pdffile;


    //        //string _refid = "L" + convertno;
    //        //MyMailManager.SendCarProposalAttachment("Liberty Insurance", _providerEmail, _providerCCEmail, _providerBCCEmail, "", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), _refid, "Liberty", filelist);

    //    }

    //    return filelist;

    //    //SEND MAIL
    //    //string _providerEmail = "cherylmae.lanot@teledirect.com.sg"; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_TO");
    //    //string _providerCCEmail = ""; //CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_CC");
    //    //string _providerBCCEmail = ""; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_BCC");

    //    //string[] filelist = new string[1];
    //    //string _excelfile = Server.MapPath("/pdfoutput/" + _fileName + ".pdf");
    //    //filelist[0] = _excelfile;
    //    //string _refid = "L" + convertno;
    //    //MyMailManager.SendCarProposalAttachment("Liberty Insurance", _providerEmail, _providerCCEmail, _providerBCCEmail, "", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), _refid, "Liberty", filelist);
    //}
    #endregion

    private string[] GeneratePDFProposalForm(Int64 RefID, Int32 UserType)
    {
        string[] filelist = new string[1];

        LibertyCarInsurancePDFOutput GeneratePDF = new LibertyCarInsurancePDFOutput();

        string convertno = General.GetRefNumber(RefID);
        string _fileName = "L" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

        DataSet _dsProposal = new DataSet();
        ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
        _dsProposal = _proposaldownloaddb.GetLibertyProposal(RefID, "CI");


        if (_dsProposal.Tables[0].Rows.Count > 0)
        {
            GeneratePDF.ClearFields();
            #region variables
            string _name, _unitno, _homeno, _address, _postalcode, _dob, _dd, _mm, _yy, _nationality, _nric, _maritalstatus, _officeno, _mobile;
            string _gender, _expdriving, _vehicleno, _make, _model, _vehicletype, _engineno, _chassisno, _cc, _regyear, _mfgyear, _hpstatus, _hpcomp;
            string _insstartdate, _insenddate, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _insstatus, _inscomp, _insvhleno, _insncdentitle;
            string _inspldate, _indd, _inmm, _inyy, _ncdreson, _bodytype, _occupation, _empname, _drwestmylsa, _vhlemodifystatus, _vhlemodifyreason;
            string _drname1, _drage1, _drgender1, _drmarital1, _drocc1, _drexp1, _drname2, _drage2, _drgender2, _drmarital2, _drocc2, _drexp2;
            string _drname3, _drage3, _drgender3, _drmarital3, _drocc3, _drexp3, _drname4, _drage4, _drgender4, _drmarital4, _drocc4, _drexp4;
            string _drname5, _drage5, _drgender5, _drmarital5, _drocc5, _drexp5, _demeritstatus, _demeritcount, _dmdrname1, _dmdrpoint1, _producerCode;
            string _drDOB1, _drDOB2, _drDOB3, _drDOB4, _drDOB5;
            string _dmdrdate1, _dmdrtype1, _dmdrname2, _dmdrpoint2, _dmdrdate2, _dmdrtype2, _dmdrname3, _dmdrpoint3, _dmdrdate3, _dmdrtype3;
            string _dmdrname4, _dmdrpoint4, _dmdrdate4, _dmdrtype4, _dmdrname5, _dmdrpoint5, _dmdrdate5, _dmdrtype5, _dmdrname6, _dmdrpoint6;
            string _dmdrdate6, _dmdrtype6, _adddriver, _drcount, _paymenttype, _installmenttype, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _claimstatus, _claim1ststat, _claim1stend;
            string _claimcount1, claimamt1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _ncdnil;
            string _inscancelstatus, _cancelreason, _impairstatus, _impairreason, _accessorystatus, _accessorydetail, _convictedstatus, _convictedreason, _planname, _basicpremium, _annualpremium, _agerestriction, _agerestrictionamount;
            string _insrefusedstatus, _refusedreason, _jobnature, _email, _ncdexisting, _claimcount;
            string _drjobnature1, _drjobnature2, _drjobnature3, _drjobnature4, _drjobnature5;
            int _excess, _cxcovertypeid;
            bool _isncdprotect = false;
            bool _isOFD = false;
            DateTime _dofb, _isdate, _iedate, _indate;

            _email = ""; _mfgyear = "1990"; _regyear = "1990"; _cc = "1111"; _ncdexisting = "0"; _claimcount = "0";
            _jobnature = ""; _drjobnature1 = ""; _drjobnature2 = ""; _drjobnature3 = ""; _drjobnature4 = ""; _drjobnature5 = "";
            _inscancelstatus = "false"; _cancelreason = ""; _impairstatus = "false"; _impairreason = ""; _demeritstatus = "false"; _demeritcount = "";
            _dmdrname1 = ""; _dmdrpoint1 = ""; _dmdrdate1 = ""; _dmdrtype1 = ""; _dmdrname2 = ""; _dmdrpoint2 = ""; _dmdrdate2 = ""; _dmdrtype2 = "";
            _dmdrname3 = ""; _dmdrpoint3 = ""; _dmdrdate3 = ""; _dmdrtype3 = ""; _dmdrname4 = ""; _dmdrdate4 = ""; _dmdrtype4 = "";
            _dmdrpoint4 = ""; _dmdrname5 = ""; _dmdrpoint5 = ""; _dmdrdate5 = ""; _dmdrtype5 = ""; _dmdrname6 = ""; _producerCode = "D9999-CX";
            _dmdrpoint6 = ""; _dmdrdate6 = ""; _dmdrtype6 = ""; _vehicletype = ""; _expdriving = "0";
            _drname1 = ""; _drage1 = ""; _drgender1 = ""; _drmarital1 = ""; _drocc1 = ""; _drexp1 = "0";
            _drname2 = ""; _drage2 = ""; _drgender2 = ""; _drmarital2 = ""; _drocc2 = ""; _drexp2 = "0";
            _drname3 = ""; _drage3 = ""; _drgender3 = ""; _drmarital3 = ""; _drocc3 = ""; _drexp3 = "0";
            _drname4 = ""; _drage4 = ""; _drgender4 = ""; _drmarital4 = ""; _drocc4 = ""; _drexp4 = "0";
            _drname5 = ""; _drage5 = ""; _drgender5 = ""; _drmarital5 = ""; _drocc5 = ""; _drexp5 = "0"; _planname = ""; _annualpremium = "0"; _agerestriction = "0"; _agerestrictionamount = "0";
            _adddriver = ""; _drcount = ""; _paymenttype = ""; _installmenttype = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";
            _insrefusedstatus = "false"; _refusedreason = ""; _excess = 0;
            _drDOB1 = "01/01/1980"; _drDOB2 = "01/01/1980"; _drDOB3 = "01/01/1980"; _drDOB4 = "01/01/1980"; _drDOB5 = "01/01/1980";
            _inspldate = "01/01/1980"; _cxcovertypeid = 0;

            _name = _dsProposal.Tables[0].Rows[0]["Name"].ToString();
            _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
            _dd = _dofb.Day.ToString("00");
            _mm = _dofb.Month.ToString("00");
            _yy = _dofb.Year.ToString();
            //_dob = _dd + "/" + _mm + "/" + _yy;
            _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
            _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
            _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
            _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
            _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
            _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
            _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
            _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
            _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();
            _jobnature = _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
            _email = _dsProposal.Tables[0].Rows[0]["Email"].ToString();
            _cxcovertypeid = Convert.ToInt32(_dsProposal.Tables[0].Rows[0]["CXCoverTypeId"].ToString());

            _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
            _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();
            _excess = int.Parse(_dsProposal.Tables[0].Rows[0]["Excess"].ToString());
            //Phyo
            _basicpremium = _dsProposal.Tables[0].Rows[0]["FInfo2"].ToString();
            //Sakthi on 10 Jan 2011 - start
            if (_dsProposal.Tables[0].Rows[0]["NInfo5"].ToString() != null)
            {
                _agerestriction = _dsProposal.Tables[0].Rows[0]["NInfo5"].ToString();
            }

            //if (_agerestriction != "0")
            //{
            //    _basicpremium = _dsProposal.Tables[0].Rows[0]["FInfo2"].ToString();
            //}
            //Sakthi on 10 Jan 2011 - end

            _drwestmylsa = _dsProposal.Tables[0].Rows[0]["DrWMalaysia"].ToString();
            _expdriving = _dsProposal.Tables[0].Rows[0]["YearDriveSg"].ToString();
            _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString();
            _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
            _officeno = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            _empname = _dsProposal.Tables[0].Rows[0]["EmpNameandTrade"].ToString();
            _isOFD = Convert.ToBoolean(_dsProposal.Tables[0].Rows[0]["IsOffDriveCom"]);

            if (_dsProposal.Tables[0].Rows[0]["Ninfo1"] != null && _dsProposal.Tables[0].Rows[0]["Ninfo1"].ToString() != "")
            {
                Int64 _Agent = Convert.ToInt64(_dsProposal.Tables[0].Rows[0]["Ninfo1"].ToString());
                if (_Agent == 0)
                {
                    _producerCode = "D9999-CX";
                }
                else
                {
                    _producerCode = "D9999-TD";
                }
            }
            else
            {
                _producerCode = "D9999-CX";
            }

            if (_dsProposal.Tables[0].Rows[0]["Info3"] != null && _dsProposal.Tables[0].Rows[0]["Info3"].ToString() != "")
                if (_dsProposal.Tables[0].Rows[0]["Info3"].ToString() == "1")
                    _isncdprotect = true;
                else
                    _isncdprotect = false;

            if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
            {
                _claimstatus = "No";
            }
            else
            {
                _claimstatus = "Yes";
                _claimcount = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();
            }
            if (_dsProposal.Tables[0].Rows[0]["HasPreInsurer"].ToString() == "True")
            {
                _insstatus = "Yes";
                if (_dsProposal.Tables[2].Rows.Count > 0)
                {
                    _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();
                    _insvhleno = _dsProposal.Tables[0].Rows[0]["PreInsVechicleNo"].ToString();
                    _indate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString());
                    _indd = _indate.Day.ToString("00");
                    _inmm = _indate.Month.ToString("00");
                    _inyy = _indate.Year.ToString();
                    //_inspldate = _dd + "/" + _mm + "/" + _yy;
                    _inspldate = _dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString();
                    if (_dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() == "-1")
                    {
                        _insncdentitle = "false";
                    }
                    else
                    {
                        _insncdentitle = _dsProposal.Tables[0].Rows[0]["NCDEntitlement"].ToString() + "%";
                    }
                }
                else
                {
                    _insstatus = "false";
                    _inscomp = "";
                    _insvhleno = "";
                    _inspldate = "01/01/1990";
                    _insncdentitle = "false";
                }
            }
            else
            {
                _insstatus = "false";
                _inscomp = "";
                _insvhleno = "";
                _inspldate = "1/1/1990";
                _insncdentitle = "false";
            }

            _ncdexisting = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
            _ncdpercent = _dsProposal.Tables[0].Rows[0]["NextNCD"].ToString();

            _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
            if (_ncdreson == "Others")
            {
                _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
            }
            else if (_ncdreson == "-1")
            {
                _ncdreson = "";
            }

            _paymenttype = _dsProposal.Tables[0].Rows[0]["PamentType"].ToString();

            if (_dsProposal.Tables[1].Rows.Count > 0)
            {
                _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
                _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
                claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
                _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

                _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
                _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
                claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

                _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
                _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
                claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
            }
            else
            {
                _claim1ststat = "";
                _claim1stend = "";
                claimamt1 = "";
                _claimcount1 = "0";

                _claim2ndstat = "";
                _claim2ndend = "";
                claimamt2 = "";

                _claim3rdstat = "";
                _claim3rdend = "";
                claimamt3 = "";
                _claimstatus = "No";

            }


            _vhlemodifystatus = _dsProposal.Tables[0].Rows[0]["HasVechicleModified"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["HasVechicleModified"].ToString() == "True")
            {
                _vhlemodifyreason = _dsProposal.Tables[0].Rows[0]["VechicleModifyReason"].ToString();
            }
            else
            {
                _vhlemodifyreason = "";
            }
            _inscancelstatus = _dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString() == "True")
            {
                _cancelreason = _dsProposal.Tables[0].Rows[0]["InsuranceTerminatedReason"].ToString();
            }
            else
            {
                _cancelreason = "";
            }
            _impairstatus = _dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString() == "True")
            {
                _impairreason = _dsProposal.Tables[0].Rows[0]["PhysicalImpairmentReason"].ToString();
            }
            else
            {
                _impairreason = "";
            }

            _convictedstatus = _dsProposal.Tables[0].Rows[0]["HasConvictedMoterOffence"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["HasConvictedMoterOffence"].ToString() == "True")
            {
                _convictedreason = _dsProposal.Tables[0].Rows[0]["ConvictedReason"].ToString();
            }
            else
            {
                _convictedreason = "";
            }

            _accessorystatus = _dsProposal.Tables[0].Rows[0]["HasAccessory"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["HasAccessory"].ToString() == "True")
            {
                _accessorydetail = _dsProposal.Tables[0].Rows[0]["AccessoryDescription"].ToString();
            }
            else
            {
                _accessorydetail = "";
            }

            if (_dsProposal.Tables[0].Rows[0]["Info1"].ToString() == "1")
            {
                _insrefusedstatus = "true";
                _refusedreason = _dsProposal.Tables[0].Rows[0]["Info2"].ToString();
            }
            else
            {
                _insrefusedstatus = "false";
                _refusedreason = "";
            }

            _demeritstatus = _dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString() == "True")
            {
                if (_dsProposal.Tables[6].Rows.Count > 0)
                {
                    _demeritcount = _dsProposal.Tables[6].Rows.Count.ToString();

                    _dmdrname1 = _dsProposal.Tables[6].Rows[0]["DriverName"].ToString();
                    _dmdrpoint1 = _dsProposal.Tables[6].Rows[0]["TotalDemeritPoints"].ToString();
                    _dmdrdate1 = _dsProposal.Tables[6].Rows[0]["DemeritDate"].ToString();
                    _dmdrtype1 = _dsProposal.Tables[6].Rows[0]["TypeofOffence"].ToString();
                    if (_dsProposal.Tables[6].Rows.Count > 1)
                    {
                        _dmdrname2 = _dsProposal.Tables[6].Rows[1]["DriverName"].ToString();
                        _dmdrpoint2 = _dsProposal.Tables[6].Rows[1]["TotalDemeritPoints"].ToString();
                        _dmdrdate2 = _dsProposal.Tables[6].Rows[1]["DemeritDate"].ToString();
                        _dmdrtype2 = _dsProposal.Tables[6].Rows[1]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 2)
                    {
                        _dmdrname3 = _dsProposal.Tables[6].Rows[2]["DriverName"].ToString();
                        _dmdrpoint3 = _dsProposal.Tables[6].Rows[2]["TotalDemeritPoints"].ToString();
                        _dmdrdate3 = _dsProposal.Tables[6].Rows[2]["DemeritDate"].ToString();
                        _dmdrtype3 = _dsProposal.Tables[6].Rows[2]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 3)
                    {
                        _dmdrname4 = _dsProposal.Tables[6].Rows[3]["DriverName"].ToString();
                        _dmdrpoint4 = _dsProposal.Tables[6].Rows[3]["TotalDemeritPoints"].ToString();
                        _dmdrdate4 = _dsProposal.Tables[6].Rows[3]["DemeritDate"].ToString();
                        _dmdrtype4 = _dsProposal.Tables[6].Rows[3]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 4)
                    {
                        _dmdrname5 = _dsProposal.Tables[6].Rows[4]["DriverName"].ToString();
                        _dmdrpoint5 = _dsProposal.Tables[6].Rows[4]["TotalDemeritPoints"].ToString();
                        _dmdrdate5 = _dsProposal.Tables[6].Rows[4]["DemeritDate"].ToString();
                        _dmdrtype5 = _dsProposal.Tables[6].Rows[4]["TypeofOffence"].ToString();
                    }
                    if (_dsProposal.Tables[6].Rows.Count > 5)
                    {
                        _dmdrname6 = _dsProposal.Tables[6].Rows[5]["DriverName"].ToString();
                        _dmdrpoint6 = _dsProposal.Tables[6].Rows[5]["TotalDemeritPoints"].ToString();
                        _dmdrdate6 = _dsProposal.Tables[6].Rows[5]["DemeritDate"].ToString();
                        _dmdrtype6 = _dsProposal.Tables[6].Rows[5]["TypeofOffence"].ToString();
                    }
                }
                else
                {
                    _demeritstatus = "false";
                    _demeritcount = "0";
                }
            }
            else
            {
                _demeritstatus = "false";
                _demeritcount = "0";
            }

            _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
            _mfgyear = _dsProposal.Tables[0].Rows[0]["ManufactYear"].ToString();
            _regyear = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DateofReg"]).Year.ToString();
            _model = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
            _make = _dsProposal.Tables[5].Rows[0]["Make"].ToString();
            _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
            _vehicletype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
            _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
            _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

            _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
            _isdd = _isdate.Day.ToString("00");
            _ismm = _isdate.Month.ToString("00");
            _isyy = _isdate.Year.ToString();
            //_insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
            _insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

            _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
            _iedd = _iedate.Day.ToString("00");
            _iemm = _iedate.Month.ToString("00");
            _ieyy = _iedate.Year.ToString();
            //_insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
            _insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

            if (_dsProposal.Tables[3].Rows.Count > 0)
            {
                _hpstatus = "false";
                _hpcomp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

                if (_hpcomp.ToString() == "")
                {
                    _hpcomp = "Not Applicable";
                }
            }
            else
            {
                _hpstatus = "false";
                _hpcomp = "Not Applicable";
            }
            if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
            {
                _adddriver = "true";
                _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
            }
            else
            {
                _adddriver = "false";
                _drcount = "0";
            }
            if (_dsProposal.Tables[4].Rows.Count > 0)
            {
                if (Convert.ToInt16(_drcount) > 0)
                {
                    _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
                    _drage1 = _dsProposal.Tables[4].Rows[0]["Age"].ToString();
                    _drgender1 = _dsProposal.Tables[4].Rows[0]["Gender"].ToString();
                    _drmarital1 = _dsProposal.Tables[4].Rows[0]["Marital"].ToString();
                    _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
                    _drexp1 = _dsProposal.Tables[4].Rows[0]["YearOfDrivingInSg"].ToString();
                    _drDOB1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
                    _drjobnature1 = _dsProposal.Tables[4].Rows[0]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
                    _drage2 = _dsProposal.Tables[4].Rows[1]["Age"].ToString();
                    _drgender2 = _dsProposal.Tables[4].Rows[1]["Gender"].ToString();
                    _drmarital2 = _dsProposal.Tables[4].Rows[1]["Marital"].ToString();
                    _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
                    _drexp2 = _dsProposal.Tables[4].Rows[1]["YearOfDrivingInSg"].ToString();
                    _drDOB2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
                    _drjobnature2 = _dsProposal.Tables[4].Rows[1]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
                    _drage3 = _dsProposal.Tables[4].Rows[2]["Age"].ToString();
                    _drgender3 = _dsProposal.Tables[4].Rows[2]["Gender"].ToString();
                    _drmarital3 = _dsProposal.Tables[4].Rows[2]["Marital"].ToString();
                    _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
                    _drexp3 = _dsProposal.Tables[4].Rows[2]["YearOfDrivingInSg"].ToString();
                    _drDOB3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
                    _drjobnature3 = _dsProposal.Tables[4].Rows[2]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
                    _drage4 = _dsProposal.Tables[4].Rows[3]["Age"].ToString();
                    _drgender4 = _dsProposal.Tables[4].Rows[3]["Gender"].ToString();
                    _drmarital4 = _dsProposal.Tables[4].Rows[3]["Marital"].ToString();
                    _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
                    _drexp4 = _dsProposal.Tables[4].Rows[3]["YearOfDrivingInSg"].ToString();
                    _drDOB4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
                    _drage5 = _dsProposal.Tables[4].Rows[4]["Age"].ToString();
                    _drgender5 = _dsProposal.Tables[4].Rows[4]["Gender"].ToString();
                    _drmarital5 = _dsProposal.Tables[4].Rows[4]["Marital"].ToString();
                    _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
                    _drexp5 = _dsProposal.Tables[4].Rows[4]["YearOfDrivingInSg"].ToString();
                    _drDOB5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
                    _drjobnature5 = _dsProposal.Tables[4].Rows[4]["JobNature"].ToString();
                }
            }


            DataSet _dsPayment = new DataSet();
            //if (rdoCreditCard.Checked)
            //{
                _dsPayment = _proposaldownloaddb.GetPaymentDetails(RefID, 29, "CI");
                if (_dsPayment != null && _dsPayment.Tables[0].Rows.Count > 0)
                {
                    _nameofcard = _dsPayment.Tables[0].Rows[0]["NameoftheCard"].ToString();
                    _issuebank = _dsPayment.Tables[0].Rows[0]["IssuingBankName"].ToString();
                    _cno = _dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString();
                    _ccexmm = _dsPayment.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
                    _ccexyy = _dsPayment.Tables[0].Rows[0]["CardExpiryYear"].ToString();
                    _cctype = _dsPayment.Tables[0].Rows[0]["CardType"].ToString();
                    _installmenttype = _dsPayment.Tables[0].Rows[0]["Installment"].ToString();
                    if (_dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString() != "")
                        _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);
                    else
                        _ccno = "";

                }
            //}
            #endregion

            GeneratePDF.CxCoverTypeId = _cxcovertypeid;
            GeneratePDF.ProposalNo = ""; // "L" + convertno;
            GeneratePDF.QuotationNo = "L" + convertno;
            //GeneratePDF.ApplicationDate = CE.Global.General.GetUTCDateTime();
            GeneratePDF.ApplicationDate = Convert.ToDateTime("02/07/2011");
            GeneratePDF.NRIC = _nric;
            GeneratePDF.CustomerName = _name;
            GeneratePDF.CustomerAddress = _address;
            GeneratePDF.CustomerUnitNo = _unitno;
            GeneratePDF.CustomerHomeNo = _homeno;
            GeneratePDF.CustomerPostCode = _postalcode;
            GeneratePDF.MobileNo = _mobile;
            GeneratePDF.OfficeNo = _officeno;
            //GeneratePDF.OfficeMobileNo = _mobile + "/" + _officeno;
            GeneratePDF.EmployersName = _empname;
            GeneratePDF.EmailAddress = _email;
            GeneratePDF.CustomerDOB = Convert.ToDateTime(_dob);
            GeneratePDF.CustomerGender = _gender;
            GeneratePDF.CustomerOccupation = _occupation;
            GeneratePDF.CustomerJobNature = _jobnature;
            GeneratePDF.CustomerMaritalStatus = _maritalstatus;
            GeneratePDF.CustomerDrivingExperience = int.Parse(_expdriving);

            GeneratePDF.Driver1Name = _drname1;
            GeneratePDF.Driver1gender = _drgender1;
            GeneratePDF.Driver1DOB = Convert.ToDateTime(_drDOB1);
            GeneratePDF.Driver1Occupation = _drocc1;
            GeneratePDF.Driver1JobNature = _drjobnature1;
            GeneratePDF.Driver1MaritalStatus = _drmarital1;
            GeneratePDF.Driver1DrivingExperience = int.Parse(_drexp1);

            GeneratePDF.Driver2Name = _drname2;
            GeneratePDF.Driver2gender = _drgender2;
            GeneratePDF.Driver2DOB = Convert.ToDateTime(_drDOB2);
            GeneratePDF.Driver2Occupation = _drocc2;
            GeneratePDF.Driver2JobNature = _drjobnature2;
            GeneratePDF.Driver2MaritalStatus = _drmarital2;
            GeneratePDF.Driver2DrivingExperience = int.Parse(_drexp2);

            GeneratePDF.Driver3Name = _drname3;
            GeneratePDF.Driver3gender = _drgender3;
            GeneratePDF.Driver3DOB = Convert.ToDateTime(_drDOB3);
            GeneratePDF.Driver3Occupation = _drocc3;
            GeneratePDF.Driver3JobNature = _drjobnature3;
            GeneratePDF.Driver3MaritalStatus = _drmarital3;
            GeneratePDF.Driver3DrivingExperience = int.Parse(_drexp3);

            GeneratePDF.Driver4Name = _drname4;
            GeneratePDF.Driver4gender = _drgender4;
            GeneratePDF.Driver4DOB = Convert.ToDateTime(_drDOB4);
            GeneratePDF.Driver4Occupation = _drocc4;
            GeneratePDF.Driver4JobNature = _drjobnature4;
            GeneratePDF.Driver4MaritalStatus = _drmarital4;
            GeneratePDF.Driver4DrivingExperience = int.Parse(_drexp4);

            GeneratePDF.Driver5Name = _drname5;
            GeneratePDF.Driver5gender = _drgender5;
            GeneratePDF.Driver5DOB = Convert.ToDateTime(_drDOB5);
            GeneratePDF.Driver5Occupation = _drocc5;
            GeneratePDF.Driver5JobNature = _drjobnature5;
            GeneratePDF.Driver5MaritalStatus = _drmarital5;
            GeneratePDF.Driver5DrivingExperience = int.Parse(_drexp5);

            GeneratePDF.VehicleNo = _vehicleno;
            GeneratePDF.ChassisNo = _chassisno;
            GeneratePDF.EngineNo = _engineno;
            GeneratePDF.BodyType = _vehicletype;
            GeneratePDF.CarMake = _make;

            string modelonly = "";

            if ((_make.ToLower() == "alfa romeo") || (_make.ToLower() == "land rover"))
            {
                modelonly = _model.Substring(11);
            }
            else if (_make.ToLower() == "mercedes benz")
            {
                modelonly = _model.Substring(12);
            }
            else
            {
                int spacecheck = _model.IndexOf(" ") + 1;
                modelonly = _model.Substring(spacecheck);
            }

            GeneratePDF.CarModel = modelonly;
            GeneratePDF.YearOfManufacture = int.Parse(_mfgyear);
            GeneratePDF.YearOfRegistration = int.Parse(_regyear);
            GeneratePDF.CarSeaters = 0;
            GeneratePDF.CarCC = int.Parse(_cc);
            GeneratePDF.OdometerReading = "";
            GeneratePDF.EstimatedMarketValue = "";

            GeneratePDF.CurrentInsuranceCo = _inscomp;
            GeneratePDF.PolicyNo = "";
            GeneratePDF.ExpiryCancellationDate = Convert.ToDateTime(_inspldate);
            GeneratePDF.Last3YearsClaimXP = _claimstatus;
            GeneratePDF.NoClaimsLast3Years = _claimcount;

            //if (_ncdpercent == "-1")
            //    GeneratePDF.NCDPercent = "No NCD(first policy)";
            //else
            GeneratePDF.NCDPercent = _ncdpercent;

            GeneratePDF.NCDNilDetails = _ncdreson;

            GeneratePDF.IsCarModified = bool.Parse(_vhlemodifystatus);
            GeneratePDF.ModifiedReason = _vhlemodifyreason;

            GeneratePDF.FinanceCo = _hpcomp;
            GeneratePDF.ConvictedReason = _convictedreason;
            //GeneratePDF.PeriodFrom = Convert.ToDateTime(_insstartdate);
            //GeneratePDF.PeriodTo = Convert.ToDateTime(_insenddate);
            GeneratePDF.PeriodFrom = Convert.ToDateTime(_insstartdate);
            GeneratePDF.PeriodTo = Convert.ToDateTime(_insenddate);
            GeneratePDF.TypeOfCover = _planname;

            GeneratePDF.DriveToWestMalaysia = _drwestmylsa;
            GeneratePDF.IsConvictedOfMotoringOffense = bool.Parse(_convictedstatus);
            GeneratePDF.ConvictedReason = _convictedreason;
            GeneratePDF.IsGivenDemeritPoints = bool.Parse(_demeritstatus);

            if (_dmdrtype6 != "")
            {
                GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3 + ", " + _dmdrtype4 + ", " + _dmdrtype5 + ", " + _dmdrtype6;
            }
            else if (_dmdrtype5 != "")
            {
                GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3 + ", " + _dmdrtype4 + ", " + _dmdrtype5;
            }
            else if (_dmdrtype4 != "")
            {
                GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3 + ", " + _dmdrtype4;
            }
            else if (_dmdrtype3 != "")
            {
                GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2 + ", " + _dmdrtype3;
            }
            else if (_dmdrtype2 != "")
            {
                GeneratePDF.DemeritPointsReason = _dmdrtype1 + ", " + _dmdrtype2;
            }
            else if (_dmdrtype1 != "")
            {
                GeneratePDF.DemeritPointsReason = _dmdrtype1;
            }

            GeneratePDF.isDisabled = Convert.ToBoolean(_impairstatus);
            GeneratePDF.DisablityReason = _impairreason;

            GeneratePDF.IsRefusedMotorInsurance = Convert.ToBoolean(_insrefusedstatus);
            GeneratePDF.RefusedReason = _refusedreason;

            GeneratePDF.IsTerminatedDueToPayment = Convert.ToBoolean(_inscancelstatus);
            GeneratePDF.TerminatedReason = _cancelreason;

            GeneratePDF.TotalPremium = float.Parse(_annualpremium);

            if (_cxcovertypeid == 5)
            {
                GeneratePDF.TotalPremium += 321;
            }
            else if (_cxcovertypeid == 6)
            {
                GeneratePDF.TotalPremium += 160.5f;
            }
            else if (_cxcovertypeid == 7)
            {
                GeneratePDF.TotalPremium += 642;
            }

            GeneratePDF.Excess = _excess;
            GeneratePDF.ProducerCode = _producerCode;

            float grosspremium = 0;
            float gstrate = 0;
            float ofdrate = 0;
            float adddiscrate = 0;
            float ncdrate = 0;
            float basicpremium = 0;
            float ncdprotectrate = 0;
            float additionaldriverrate = 0;

            //if (_drcount != "0")
            //{
            //    additionaldriverrate = (25 * int.Parse(_drcount)) * 1.07;
            //}

            if (_isOFD)
                GeneratePDF.OFD = "Yes";
            else
                GeneratePDF.OFD = "No";

            if (_isncdprotect)
                GeneratePDF.NCDProtector = "Yes";
            else
                GeneratePDF.NCDProtector = "No";

            GeneratePDF.AdditionalDriverCharge = float.Parse(additionaldriverrate.ToString());

            #region "Old Backward Calculation"
            //gstrate = (GeneratePDF.TotalPremium) / 107 * 7;
            //grosspremium = (GeneratePDF.TotalPremium) / 107 * 100;

            //GeneratePDF.GSTRate = float.Parse(gstrate.ToString());
            //GeneratePDF.GrossPremium = float.Parse(grosspremium.ToString());


            //if (_isncdprotect)
            //{
            //    ncdprotectrate = (GeneratePDF.GrossPremium / 110) * 10;
            //}

            //if (_isOFD && Convert.ToInt32(_ncdpercent) >= 30)
            //{
            //    ofdrate = (GeneratePDF.GrossPremium - ncdprotectrate) / 95 * 5;
            //}

            ////if (_ncdpercent == "10" || _ncdpercent == "20" || _ncdpercent == "30")
            ////{
            ////    adddiscrate = (GeneratePDF.GrossPremium - ncdprotectrate) / 95 * 5;
            ////}

            //if (_ncdpercent == "0" || _ncdpercent == "-1")
            //{
            //    ncdrate = 0;
            //    basicpremium = GeneratePDF.GrossPremium;
            //}

            //else if (_ncdpercent == "10")
            //{
            //    ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 90 * 10;
            //    basicpremium = (ncdrate / 10) * 100;
            //}
            //else if (_ncdpercent == "20")
            //{
            //    ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 80 * 20;
            //    basicpremium = (ncdrate / 20) * 100;
            //}
            //else if (_ncdpercent == "30")
            //{
            //    ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 70 * 30;
            //    basicpremium = (ncdrate / 30) * 100;
            //}
            //else if (_ncdpercent == "40")
            //{
            //    ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 60 * 40;
            //    basicpremium = (ncdrate / 40) * 100;
            //}
            //else if (_ncdpercent == "50")
            //{
            //    ncdrate = ((GeneratePDF.GrossPremium + ofdrate) - ncdprotectrate) / 50 * 50;
            //    basicpremium = (ncdrate / 50) * 100;
            //}

            ////Sakthi on 11 Jan 2011 -- Start

            //double _Tempbasicpremium = 0;
            //Int32 _NCD = Convert.ToInt32(_ncdpercent);
            //if (_ncdpercent == "0" || _ncdpercent == "-1")
            //{
            //    ncdrate = 0;
            //    _Tempbasicpremium = GeneratePDF.GrossPremium;
            //}
            //else
            //{
            //    _Tempbasicpremium = (ncdrate / _NCD) * 100;
            //}

            //if (_agerestriction == "1")
            //{
            //    basicpremium = ((_Tempbasicpremium / 90) * 100);
            //    _agerestrictionamount = (basicpremium * .1).ToString();
            //}
            //else if (_agerestriction == "2")
            //{
            //    basicpremium = ((_Tempbasicpremium / 92.5) * 100);
            //    _agerestrictionamount = (basicpremium * .075).ToString();
            //}
            ////Sakthi on 11 Jan 2011 -- End


            //GeneratePDF.OFDRate = float.Parse(ofdrate.ToString());
            ////GeneratePDF.AddDiscountRate = float.Parse(adddiscrate.ToString());
            //if (_cxcovertypeid == 5)
            //{
            //    GeneratePDF.TotalPremium -= 321;
            //    GeneratePDF.BuyUpDownRate = 321;
            //}
            //else if (_cxcovertypeid == 6)
            //{
            //    GeneratePDF.TotalPremium -= 160.5f;
            //    GeneratePDF.BuyUpDownRate = 160.5f;
            //}
            //else if (_cxcovertypeid == 7)
            //{
            //    GeneratePDF.TotalPremium -= 642;
            //    GeneratePDF.BuyUpDownRate = 642;
            //}
            //else
            //{
            //    GeneratePDF.BuyUpDownRate = 0;
            //}
            #endregion

            float _orgBasicPremium = Convert.ToSingle(_basicpremium);
            basicpremium = _orgBasicPremium;

            if (_agerestriction == "1")
            {
                _agerestrictionamount = (_orgBasicPremium * 0.1).ToString("#.00"); ;
                _orgBasicPremium -= Convert.ToSingle(_agerestrictionamount);
            }
            else if (_agerestriction == "2")
            {
                _agerestrictionamount = (_orgBasicPremium * 0.075).ToString("#.00"); ;
                _orgBasicPremium -= Convert.ToSingle(_agerestrictionamount);
            }

            if (_ncdpercent != "0" && _ncdpercent != "-1")
            {
                ncdrate = _orgBasicPremium * (Convert.ToSingle(_ncdpercent) / 100f);
                _orgBasicPremium -= ncdrate;

                if (_isOFD && Convert.ToInt32(_ncdpercent) >= 30)
                {
                    ofdrate = _orgBasicPremium * 0.05f;
                    _orgBasicPremium -= ofdrate;
                    GeneratePDF.OFDRate = ofdrate;
                }
            }

            if (_isncdprotect)
            {
                ncdprotectrate = _orgBasicPremium * 0.1f;
                //ncdprotectrate += (ncdprotectrate * 0.07f);
                _orgBasicPremium += ncdprotectrate;
            }

            grosspremium = _orgBasicPremium;
            GeneratePDF.GrossPremium = grosspremium;

            gstrate = _orgBasicPremium * 0.07f;
            _orgBasicPremium += gstrate;
            GeneratePDF.GSTRate = gstrate;
            
            if (_cxcovertypeid == 5)
            {
                _orgBasicPremium -= 321f;
                GeneratePDF.BuyUpDownRate = 321f;
            }
            else if (_cxcovertypeid == 6)
            {
                _orgBasicPremium -= 160.5f;
                GeneratePDF.BuyUpDownRate = 160.5f;
            }
            else if (_cxcovertypeid == 7)
            {
                _orgBasicPremium -= 642f;
                GeneratePDF.BuyUpDownRate = 642f;
            }
            else
            {
                GeneratePDF.BuyUpDownRate = 0;
            }

            
            GeneratePDF.TotalPremium = _orgBasicPremium;

            GeneratePDF.NCDDiscountRate = float.Parse(ncdrate.ToString());
            GeneratePDF.NCDProtectorRate = float.Parse(ncdprotectrate.ToString());
            GeneratePDF.BasicPremium = float.Parse(basicpremium.ToString());

            GeneratePDF.AgeRestriction = _agerestriction;
            GeneratePDF.AgeRestrictionAmount = float.Parse(_agerestrictionamount);

            GeneratePDF.CardType = _cctype;
            GeneratePDF.CardNo = _ccno;
            //if (rdoCreditCard.Checked)
            //{
                //GeneratePDF.CardExpiryDate = Convert.ToDateTime("01-" + _ccexmm + "-" + _ccexyy);
                GeneratePDF.CardExpiryDate = Convert.ToDateTime(_ccexmm + "-" + "01" + "-" + _ccexyy);
            //}
            //else
            //{
                //    GeneratePDF.CardExpiryDate = CE.Global.General.GetUTCDateTime();
            //}
            GeneratePDF.CardholdersName = _nameofcard;
            GeneratePDF.InstallmentType = _installmenttype;
            GeneratePDF.PaymentType = _paymenttype;

            if (UserType == 0)
                GeneratePDF.LibertyPDFProposalForm(_fileName + "-cust", UserType);
            else
                GeneratePDF.LibertyPDFProposalForm(_fileName, UserType);


            //SEND MAIL
            //string _providerEmail = "cherylmae.lanot@teledirect.com.sg"; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_TO");
            //string _providerCCEmail = ""; //CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_CC");
            //string _providerBCCEmail = ""; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_BCC");

            string _filePath = GeneratePDF.GetFilePathLiberty();

            string _pdffile = _filePath + _fileName + ".pdf";

            if (UserType == 0)
                _pdffile = _filePath + _fileName + "-cust.pdf";


            //string _pdffile = Server.MapPath("/pdfoutput/" + _fileName + ".pdf");
            filelist[0] = _pdffile;


            //string _refid = "L" + convertno;
            //MyMailManager.SendCarProposalAttachment("Liberty Insurance", _providerEmail, _providerCCEmail, _providerBCCEmail, "", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), _refid, "Liberty", filelist);

        }

        return filelist;

    }
    
    private string[] GenerateHSBCPDFProposalForm(Int64 RefID)
    {
        string[] filelist = new string[1];

        HsbcCarInsurancePDFOutput GeneratePDF = new HsbcCarInsurancePDFOutput();

        string convertno = General.GetRefNumber(RefID);
        string _fileName = "H" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

        DataSet _dsProposal = new DataSet();
        ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
        _dsProposal = _proposaldownloaddb.GetHSBCProposalPDF(RefID, "CI");


        if (_dsProposal.Tables[0].Rows.Count > 0)
        {
            GeneratePDF.ClearFields();
            #region variables
            string _name, _dob, _nationality, _nric, _drvlicenceobtained, _maritalstatus, _mobile, _hoemphone, _officephone, _faxno, _unitno, _homeno, _address;
            string _postalcode, _gender, _empname, _email, _addidentdate, _natureofaccident, _claimamount, _typeofclaim, _revokedstatus;
            string _revokedyear, _revokedreason, _claimstatus, _dd, _mm, _yy, _occupation, _jobnature, _claim1ststat, _claim1stend, claimamt1;
            string _claimcount1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent, _inscomp;
            string _ncdreson, _vehicleno, _makemodel, _cc, _enginetype, _regyear, _offpeakcar, _bodytype, _purchaseprice, _engineno, _chassisno;
            string _insstartdate, _insenddate, _hp, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _drname1, _drdob1, _drdd1, _drmm1, _dryy1, _drocc1, _drnobus1;
            string _drname2, _drdob2, _drdd2, _drmm2, _dryy2, _drocc2, _drnobus2, _drname3, _drdob3, _drdd3, _drmm3, _dryy3, _drocc3, _drnobus3;
            string _drname4, _drdob4, _drdd4, _drmm4, _dryy4, _drocc4, _drnobus4, _drname5, _drdob5, _drdd5, _drmm5, _dryy5, _drocc5, _drnobus5;
            string _adddriver, _drcount, _nameofcard, _issuebank, _ccno, _cno, _ccexmm, _ccexyy, _cctype, _planname, _covertype, _annualpremium;
            string _vehiclemodifystatus, _vehiclemodifyreason, _withoutcoeparf, _excess, _purposeofuse, _renewalncdpercent;

            string _dryearofobtained1, _drrelation1, _drrevokedstatus1, _drrevokedyear1, _drrevokedreason1, _drclaimstatus1;
            string _draccidentdate1, _drnatureofacc1, _drclaimamount1, _drtypeofclaim1;

            string _dryearofobtained2, _drrelation2, _drrevokedstatus2, _drrevokedyear2, _drrevokedreason2, _drclaimstatus2;
            string _draccidentdate2, _drnatureofacc2, _drclaimamount2, _drtypeofclaim2;
            DateTime _dofb, _isdate, _iedate, _drdofb1, _drdofb2, _drdofb3, _drdofb4, _drdofb5, _hpcomname;
            _drname1 = "N/A"; _drdob1 = "N/A"; _drdd1 = ""; _drmm1 = ""; _dryy1 = ""; _drocc1 = ""; _drnobus1 = "";
            _drname2 = "N/A"; _drdob2 = "N/A"; _drdd2 = ""; _drmm2 = ""; _dryy2 = ""; _drocc2 = ""; _drnobus2 = "";
            _drname3 = ""; _drdob3 = "01/01/1900"; _drdd3 = ""; _drmm3 = ""; _dryy3 = ""; _drocc3 = ""; _drnobus3 = "";
            _drname4 = ""; _drdob4 = "01/01/1900"; _drdd4 = ""; _drmm4 = ""; _dryy4 = ""; _drocc4 = ""; _drnobus4 = "";
            _drname5 = ""; _drdob5 = "01/01/1900"; _drdd5 = ""; _drmm5 = ""; _dryy5 = ""; _drocc5 = ""; _drnobus5 = ""; _planname = ""; _annualpremium = "";
            _adddriver = ""; _drcount = ""; _nameofcard = ""; _issuebank = ""; _ccno = ""; _ccexmm = ""; _ccexyy = ""; _cctype = "";

            _revokedstatus = "No"; _revokedyear = "N/A"; _revokedreason = "N/A";
            _addidentdate = "N/A"; _natureofaccident = "N/A"; _claimamount = "N/A"; _typeofclaim = "N/A";

            _dryearofobtained1 = "N/A"; _drrelation1 = "N/A"; _drrevokedstatus1 = "No"; _drrevokedyear1 = "N/A"; _drrevokedreason1 = "N/A";
            _drclaimstatus1 = "No"; _draccidentdate1 = "N/A"; _drnatureofacc1 = "N/A"; _drclaimamount1 = "N/A"; _drtypeofclaim1 = "N/A";

            _dryearofobtained2 = "N/A"; _drrelation2 = "N/A"; _drrevokedstatus2 = "No"; _drrevokedyear2 = "N/A"; _drrevokedreason2 = "N/A";
            _drclaimstatus2 = "No"; _draccidentdate2 = "N/A"; _drnatureofacc2 = "N/A"; _drclaimamount2 = "N/A"; _drtypeofclaim2 = "N/A";

            _name = _dsProposal.Tables[0].Rows[0]["FamilyName"].ToString() + " " + _dsProposal.Tables[0].Rows[0]["GivenName"].ToString();
            _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
            _dd = _dofb.Day.ToString("00");
            _mm = _dofb.Month.ToString("00");
            _yy = _dofb.Year.ToString().Substring(2, 2);
            //_dob = _dd + "/" + _mm + "/" + _yy;
            _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
            _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
            _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
            _drvlicenceobtained = _dsProposal.Tables[0].Rows[0]["YearofObtained"].ToString();
            _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
            _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();
            //_email = CE.Security.MySecurity.Decrypt(_dsProposal.Tables[0].Rows[0]["Email"].ToString(), true);
            _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
            _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
            _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
            _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
            _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString();
            _jobnature = _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
            _hoemphone = _dsProposal.Tables[0].Rows[0]["HomePhoneNo"].ToString();
            _mobile = _dsProposal.Tables[0].Rows[0]["MobileNo"].ToString();
            _officephone = _dsProposal.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            _faxno = _dsProposal.Tables[0].Rows[0]["FaxNo"].ToString();
            _empname = _dsProposal.Tables[0].Rows[0]["EmpName"].ToString();
            _email = _dsProposal.Tables[0].Rows[0]["Email"].ToString();

            _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
            _covertype = _dsProposal.Tables[0].Rows[0]["ProviderCoverTypeDesc"].ToString();
            _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();

            if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
            {
                _claimstatus = "No";
            }
            else
            {
                _claimstatus = "Yes";
            }

            if (_dsProposal.Tables[1].Rows.Count > 0)
            {
                _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
                _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
                claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();
                _claimcount1 = _dsProposal.Tables[1].Rows[0]["NOCLast1"].ToString();

                _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
                _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
                claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

                _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
                _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
                claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
            }
            else
            {
                _claim1ststat = "";
                _claim1stend = "";
                claimamt1 = "";
                _claimcount1 = "0";

                _claim2ndstat = "";
                _claim2ndend = "";
                claimamt2 = "";

                _claim3rdstat = "";
                _claim3rdend = "";
                claimamt3 = "";

                _ncdpercent = "0%";
            }

            if (_dsProposal.Tables[2].Rows.Count > 0)
            {
                _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();

                if (_inscomp.ToString() == "")
                {
                    _ncdstatus = "Not Applicable";
                }
                else
                {
                    _ncdstatus = "Yes";
                }
            }
            else
            {
                _ncdstatus = "No";
                _inscomp = "Not Applicable";
            }

            _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDReason"].ToString();
            if (_ncdreson.ToString() == "Others")
            {
                _ncdreson = _dsProposal.Tables[0].Rows[0]["NCDOtherReason"].ToString();
            }
            else if (_ncdreson.ToString() == "-1")
            {
                _ncdreson = "Not Applicable";
            }

            _renewalncdpercent = _dsProposal.Tables[0].Rows[0]["RenewalNCDPercent"].ToString() + "%";
            _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
            if (_ncdpercent.ToString() == "-1")
            {
                _ncdpercent = "10%";
            }
            else
            {
                if (_claimstatus == "No")
                {
                    _ncdpercent = NoNCD(_ncdpercent);
                }
                else if (_claimstatus == "Yes" && _claimcount1 == "0")
                {
                    _ncdpercent = NoNCD(_ncdpercent);
                }
                else if (_claimstatus == "Yes" && _claimcount1 == "1")
                {
                    _ncdpercent = OneTimesNCD(_ncdpercent);
                }
                else
                {
                    _ncdpercent = "0%";
                }
            }
            _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
            _regyear = _dsProposal.Tables[0].Rows[0]["RegYear"].ToString();
            _makemodel = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
            _offpeakcar = _dsProposal.Tables[0].Rows[0]["Offbeak"].ToString();
            if (Convert.ToBoolean(_dsProposal.Tables[0].Rows[0]["IsInsCOE"].ToString()) == false)
            {
                _withoutcoeparf = "Yes";
            }
            else
            {
                _withoutcoeparf = "No";
            }
            _excess = _dsProposal.Tables[0].Rows[0]["Excess"].ToString();
            _vehiclemodifystatus = _dsProposal.Tables[0].Rows[0]["VehclModify"].ToString();
            _vehiclemodifyreason = _dsProposal.Tables[0].Rows[0]["VechicleModifyReason"].ToString();
            if (_dsProposal.Tables[0].Rows[0]["PurposeofUse"].ToString() == "1")
            {
                _purposeofuse = "Social Use";
            }
            else
            {
                _purposeofuse = "Others";
            }

            _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
            _enginetype = _dsProposal.Tables[0].Rows[0]["EngineType"].ToString();
            _bodytype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
            _purchaseprice = _dsProposal.Tables[0].Rows[0]["PurchasePrice"].ToString();
            _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
            _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

            _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
            _isdd = _isdate.Day.ToString("00");
            _ismm = _isdate.Month.ToString("00");
            _isyy = _isdate.Year.ToString().Substring(2, 2);
            _insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
            //_insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

            _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
            _iedd = _iedate.Day.ToString("00");
            _iemm = _iedate.Month.ToString("00");
            _ieyy = _iedate.Year.ToString().Substring(2, 2);
            _insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
            //_insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();
            if (Convert.ToBoolean(_dsProposal.Tables[0].Rows[0]["HasLicenceRevoked"].ToString()) == true)
            {
                _revokedstatus = "Yes";
                _revokedyear = _dsProposal.Tables[0].Rows[0]["YearofRevoked"].ToString();
                _revokedreason = _dsProposal.Tables[0].Rows[0]["RevokedReason"].ToString();
            }
            if (_dsProposal.Tables[6].Rows.Count > 0)
            {
                _addidentdate = _dsProposal.Tables[6].Rows[0]["AccidentDate"].ToString();
                _natureofaccident = _dsProposal.Tables[6].Rows[0]["NatureofAccident"].ToString();
                _claimamount = _dsProposal.Tables[6].Rows[0]["ClaimAmount"].ToString();
                _typeofclaim = _dsProposal.Tables[6].Rows[0]["TypeofClaim"].ToString();
            }

            if (_dsProposal.Tables[3].Rows.Count > 0)
            {
                _hp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

                if (_hp.ToString() == "")
                {
                    _hp = "Not Applicable";
                }
            }
            else
            {
                _hp = "Not Applicable";
            }
            if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
            {
                _adddriver = "Yes";
                _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
            }
            else
            {
                _adddriver = "No";
                _drcount = "0";
            }
            if (_dsProposal.Tables[4].Rows.Count > 0)
            {
                if (Convert.ToInt16(_drcount) > 0)
                {
                    _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
                    _drdofb1 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[0]["DOB"].ToString());
                    _drdd1 = _drdofb1.Day.ToString("00");
                    _drmm1 = _drdofb1.Month.ToString("00");
                    _dryy1 = _drdofb1.Year.ToString().Substring(2, 2);
                    //_drdob1 = _drdd1 + "/" + _drmm1 + "/" + _dryy1;
                    _drdob1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
                    _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
                    _drnobus1 = _dsProposal.Tables[4].Rows[0]["DvrBusiness"].ToString();

                    _dryearofobtained1 = _dsProposal.Tables[4].Rows[0]["YearofObtained"].ToString();
                    _drrelation1 = _dsProposal.Tables[4].Rows[0]["RelationShip"].ToString();
                    if (_dsProposal.Tables[4].Rows[0]["RevokedStatus"].ToString() == "True")
                    {
                        _drrevokedstatus1 = "Yes";
                        _drrevokedyear1 = _dsProposal.Tables[4].Rows[0]["RevokedYear"].ToString();
                        _drrevokedreason1 = _dsProposal.Tables[4].Rows[0]["RevokedReason"].ToString();
                    }
                    if (_dsProposal.Tables[4].Rows[0]["ClaimStatus"].ToString() == "True")
                    {
                        _drclaimstatus1 = "Yes";
                        //DateTime _accdate1 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[0]["AccidentDate"].ToString());
                        //_draccidentdate1 = _accdate1.Day.ToString("00") + "/" + _accdate1.Month.ToString("00") + "/" + _accdate1.Year.ToString("0000");

                        string _draccidentdate1DD = _dsProposal.Tables[4].Rows[0]["AccidentDate"].ToString().Substring(0, 2);
                        string _draccidentdate1MM = _dsProposal.Tables[4].Rows[0]["AccidentDate"].ToString().Substring(3, 2);
                        string _draccidentdate1YYYY = _dsProposal.Tables[4].Rows[0]["AccidentDate"].ToString().Substring(6, 4);

                        _draccidentdate1 = _draccidentdate1DD + "/" + _draccidentdate1MM + "/" + _draccidentdate1YYYY;
                        _drnatureofacc1 = _dsProposal.Tables[4].Rows[0]["NatureofAccident"].ToString();
                        _drclaimamount1 = _dsProposal.Tables[4].Rows[0]["ClaimAmount"].ToString();
                        _drtypeofclaim1 = _dsProposal.Tables[4].Rows[0]["TypeofClaim"].ToString();
                    }
                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
                    _drdofb2 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[1]["DOB"].ToString());
                    _drdd2 = _drdofb2.Day.ToString("00");
                    _drmm2 = _drdofb2.Month.ToString("00");
                    _dryy2 = _drdofb2.Year.ToString().Substring(2, 2);
                    //_drdob2 = _drdd2 + "/" + _drmm2 + "/" + _dryy2;
                    _drdob2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
                    _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
                    _drnobus2 = _dsProposal.Tables[4].Rows[1]["DvrBusiness"].ToString();

                    _dryearofobtained2 = _dsProposal.Tables[4].Rows[1]["YearofObtained"].ToString();
                    _drrelation2 = _dsProposal.Tables[4].Rows[1]["RelationShip"].ToString();
                    if (_dsProposal.Tables[4].Rows[1]["RevokedStatus"].ToString() == "True")
                    {
                        _drrevokedstatus2 = "Yes";
                        _drrevokedyear2 = _dsProposal.Tables[4].Rows[1]["RevokedYear"].ToString();
                        _drrevokedreason2 = _dsProposal.Tables[4].Rows[1]["RevokedReason"].ToString();
                    }
                    if (_dsProposal.Tables[4].Rows[1]["ClaimStatus"].ToString() == "True")
                    {
                        _drclaimstatus2 = "Yes";
                        //DateTime _accdate2 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[1]["AccidentDate"].ToString());
                        //_draccidentdate2 = _accdate2.Day.ToString("00") + "/" + _accdate2.Month.ToString("00") + "/" + _accdate2.Year.ToString("0000");

                        string _draccidentdate2DD = _dsProposal.Tables[4].Rows[1]["AccidentDate"].ToString().Substring(0, 2);
                        string _draccidentdate2MM = _dsProposal.Tables[4].Rows[1]["AccidentDate"].ToString().Substring(3, 2);
                        string _draccidentdate2YYYY = _dsProposal.Tables[4].Rows[1]["AccidentDate"].ToString().Substring(6, 4);

                        _draccidentdate2 = _draccidentdate2DD + "/" + _draccidentdate2MM + "/" + _draccidentdate2YYYY;
                        _drnatureofacc2 = _dsProposal.Tables[4].Rows[1]["NatureofAccident"].ToString();
                        _drclaimamount2 = _dsProposal.Tables[4].Rows[1]["ClaimAmount"].ToString();
                        _drtypeofclaim2 = _dsProposal.Tables[4].Rows[1]["TypeofClaim"].ToString();
                    }
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
                    _drdofb3 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[2]["DOB"].ToString());
                    _drdd3 = _drdofb3.Day.ToString("00");
                    _drmm3 = _drdofb3.Month.ToString("00");
                    _dryy3 = _drdofb3.Year.ToString().Substring(2, 2);
                    //_drdob3 = _drdd3 + "/" + _drmm3 + "/" + _dryy3;
                    _drdob3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
                    _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
                    _drnobus3 = _dsProposal.Tables[4].Rows[2]["DvrBusiness"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
                    _drdofb4 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[3]["DOB"].ToString());
                    _drdd4 = _drdofb4.Day.ToString("00");
                    _drmm4 = _drdofb4.Month.ToString("00");
                    _dryy4 = _drdofb4.Year.ToString().Substring(2, 2);
                    //_drdob4 = _drdd4 + "/" + _drmm4 + "/" + _dryy4;
                    _drdob4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
                    _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
                    _drnobus4 = _dsProposal.Tables[4].Rows[3]["DvrBusiness"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
                    _drdofb5 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[4]["DOB"].ToString());
                    _drdd5 = _drdofb5.Day.ToString("00");
                    _drmm5 = _drdofb5.Month.ToString("00");
                    _dryy5 = _drdofb5.Year.ToString().Substring(2, 2);
                    //_drdob5 = _drdd5 + "/" + _drmm5 + "/" + _dryy5;
                    _drdob5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
                    _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
                    _drnobus5 = _dsProposal.Tables[4].Rows[4]["DvrBusiness"].ToString();
                }
            }


            DataSet _dsPayment = new DataSet();
            _dsPayment = _proposaldownloaddb.GetPaymentDetails(RefID, 23, "CI");
            if (_dsPayment != null && _dsPayment.Tables[0].Rows.Count > 0)
            {
                _nameofcard = _dsPayment.Tables[0].Rows[0]["NameoftheCard"].ToString();
                _issuebank = _dsPayment.Tables[0].Rows[0]["IssuingBankName"].ToString();
                _cno = _dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString();
                _ccexmm = _dsPayment.Tables[0].Rows[0]["CardExpiryMonth"].ToString();
                _ccexyy = _dsPayment.Tables[0].Rows[0]["CardExpiryYear"].ToString();
                _cctype = _dsPayment.Tables[0].Rows[0]["CardType"].ToString();

                if (_dsPayment.Tables[0].Rows[0]["CreditCardNo"].ToString() != "")
                    _ccno = _cno.Substring(0, 4) + "-" + _cno.Substring(4, 4) + "-" + _cno.Substring(8, 4) + "-" + _cno.Substring(12, 4);
                else
                    _ccno = "";
            }
            #endregion


            GeneratePDF.QuotationNo = "H" + convertno;
            GeneratePDF.ApplicationDate = CE.Global.General.GetUTCDateTime();
            GeneratePDF.CustomerName = _name;
            GeneratePDF.CustomerDOB = _dob;
            GeneratePDF.Nationality = _nationality;
            GeneratePDF.CustomerAddress = _address;
            GeneratePDF.CustomerUnitNo = _unitno;
            GeneratePDF.CustomerHomeNo = _homeno;
            GeneratePDF.CustomerPostCode = _postalcode;
            GeneratePDF.NRIC = _nric;
            GeneratePDF.DrvLicenceObtained = _drvlicenceobtained;
            GeneratePDF.CustomerMaritalStatus = _maritalstatus;
            GeneratePDF.CustomerGender = _gender;
            GeneratePDF.CustomerOccupation = _occupation;
            GeneratePDF.CustomerJobNature = _jobnature;
            GeneratePDF.MobileNo = _mobile;
            GeneratePDF.OfficeNo = _officephone;
            GeneratePDF.HomePhoneNo = _hoemphone;
            GeneratePDF.FaxNo = _faxno;
            GeneratePDF.EmployersName = _empname;
            GeneratePDF.EmailAddress = _email;

            GeneratePDF.AccidentDate = _addidentdate;
            GeneratePDF.NatureofAccident = _natureofaccident;
            GeneratePDF.ClaimAmount = _claimamount;
            GeneratePDF.TypeofClaim = _typeofclaim;

            GeneratePDF.IsRevoked = _revokedstatus;
            GeneratePDF.RevokedYear = _revokedyear;
            GeneratePDF.RevokedReason = _revokedreason;
            GeneratePDF.IsNCD = _ncdstatus;

            GeneratePDF.Driver1Name = _drname1;
            GeneratePDF.Driver1DOB = _drdob1;
            if (_drocc1 == "" && _drnobus1 == "")
            {
                GeneratePDF.Driver1Occupation = "N/A";
            }
            else
            {
                GeneratePDF.Driver1Occupation = _drocc1 + " / " + _drnobus1;
            }
            //GeneratePDF.Driver1Occupation = _drocc1;
            GeneratePDF.Driver1JobNature = _drnobus1;

            GeneratePDF.Driver1LicenceObtained = _dryearofobtained1;
            GeneratePDF.Driver1RelationshipToProposer = _drrelation1;
            GeneratePDF.Driver1IsRevoked = _drrevokedstatus1;
            GeneratePDF.Driver1RevokedYear = _drrevokedyear1;
            GeneratePDF.Driver1RevokedReason = _drrevokedreason1;
            GeneratePDF.Driver1IsFaultClaim = _drclaimstatus1;

            GeneratePDF.Driver1AccidentDate = _draccidentdate1;
            GeneratePDF.Driver1NatureofAccident = _drnatureofacc1;
            GeneratePDF.Driver1ClaimAmount = _drclaimamount1;
            GeneratePDF.Driver1TypeofClaim = _drtypeofclaim1;

            GeneratePDF.Driver2Name = _drname2;
            GeneratePDF.Driver2DOB = _drdob2;
            if (_drocc2 == "" && _drnobus2 == "")
            {
                GeneratePDF.Driver2Occupation = "N/A";
            }
            else
            {
                GeneratePDF.Driver2Occupation = _drocc2 + " / " + _drnobus2;
            }
            //GeneratePDF.Driver2Occupation = _drocc2;
            GeneratePDF.Driver2JobNature = _drnobus2;

            GeneratePDF.Driver2LicenceObtained = _dryearofobtained2;
            GeneratePDF.Driver2RelationshipToProposer = _drrelation2;
            GeneratePDF.Driver2IsRevoked = _drrevokedstatus2;
            GeneratePDF.Driver2RevokedYear = _drrevokedyear2;
            GeneratePDF.Driver2RevokedReason = _drrevokedreason2;
            GeneratePDF.Driver2IsFaultClaim = _drclaimstatus2;

            GeneratePDF.Driver2AccidentDate = _draccidentdate2;
            GeneratePDF.Driver2NatureofAccident = _drnatureofacc2;
            GeneratePDF.Driver2ClaimAmount = _drclaimamount2;
            GeneratePDF.Driver2TypeofClaim = _drtypeofclaim2;

            GeneratePDF.Driver3Name = _drname3;
            GeneratePDF.Driver3DOB = _drdob3;
            GeneratePDF.Driver3Occupation = _drocc3;
            GeneratePDF.Driver3JobNature = _drnobus3;

            GeneratePDF.Driver3AccidentDate = "CX_Data..";
            GeneratePDF.Driver3NatureofAccident = "CX_Data..";
            GeneratePDF.Driver3ClaimAmount = "CX_Data..";
            GeneratePDF.Driver3TypeofClaim = "CX_Data..";

            GeneratePDF.Driver4Name = _drname4;
            GeneratePDF.Driver4DOB = _drdob4;
            GeneratePDF.Driver4Occupation = _drocc4;
            GeneratePDF.Driver4JobNature = _drnobus4;

            GeneratePDF.Driver5Name = _drname5;
            GeneratePDF.Driver5DOB = _drdob5;
            GeneratePDF.Driver5Occupation = _drocc5;
            GeneratePDF.Driver5JobNature = _drnobus5;

            GeneratePDF.VehicleNo = _vehicleno;
            GeneratePDF.ChassisNo = _chassisno;
            GeneratePDF.EngineNo = _engineno;
            GeneratePDF.BodyType = _bodytype;
            GeneratePDF.CarMake = _makemodel;
            GeneratePDF.EngineType = _enginetype;

            GeneratePDF.YearOfRegistration = int.Parse(_regyear);
            GeneratePDF.CarSeaters = 0;
            GeneratePDF.CarCC = int.Parse(_cc);
            GeneratePDF.OffPeakCar = _offpeakcar;
            GeneratePDF.WithOutCOEPARF = _withoutcoeparf;
            if (_purchaseprice.ToString() != "0")
            {
                GeneratePDF.PurchasePrice = "S$" + string.Format("{0:0,0.00}", Convert.ToDouble(_purchaseprice));
            }
            else
            {
                GeneratePDF.PurchasePrice = "Not Applicable";
            }

            GeneratePDF.CurrentInsuranceCo = _inscomp;
            GeneratePDF.Last3YearsClaimXP = _claimstatus;
            GeneratePDF.NoClaimsLast3Years = _claimcount1;

            //if (_ncdexisting == "-1")
            GeneratePDF.NCDPercent = _renewalncdpercent;
            //else
            //    GeneratePDF.NCDPercent = _ncdexisting;
            GeneratePDF.CurrentInsuranceCo = _inscomp;
            GeneratePDF.NCDNilDetails = _ncdreson;
            GeneratePDF.IsCarModified = _vehiclemodifystatus;
            GeneratePDF.ModifiedReason = _vehiclemodifyreason;
            GeneratePDF.FinanceCo = _issuebank;
            GeneratePDF.HPCompanyName = _hp;
            GeneratePDF.InsStartDate = _insstartdate;
            GeneratePDF.InsEndDate = _insenddate;
            GeneratePDF.TypeOfCover = _covertype;
            GeneratePDF.PurposeOfUse = _purposeofuse;
            GeneratePDF.DemeritPointsReason = "";
            GeneratePDF.TotalPremium = string.Format("{0:0,0.00}", Convert.ToDouble(_annualpremium));
            GeneratePDF.OwnDamageExcess = _excess;
            GeneratePDF.NCDProtector = "No";
            GeneratePDF.IssuingBank = _issuebank;
            GeneratePDF.CardType = _cctype;
            GeneratePDF.CardNo = _ccno;
            //GeneratePDF.CardExpiryMonth = Convert.ToDateTime("1-" + _ccexmm + "-" + _ccexyy);
            GeneratePDF.CardholdersName = _nameofcard;

            GeneratePDF.HsbcPDFProposalForm(_fileName);

            //SEND MAIL
            //string _providerEmail = "cherylmae.lanot@teledirect.com.sg"; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_TO");
            //string _providerCCEmail = ""; //CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_CC");
            //string _providerBCCEmail = ""; // CE.Configuration.MyConfigurationManager.GetAppSettingValue("HSBCCI_BCC");

            string _filePath = GeneratePDF.GetFilePathHsbc();
            string _pdffile = _filePath + _fileName + ".pdf";

            //string _pdffile = Server.MapPath("/pdfoutput/" + _fileName + ".pdf");
            filelist[0] = _pdffile;


            //string _refid = "L" + convertno;
            //MyMailManager.SendCarProposalAttachment("Liberty Insurance", _providerEmail, _providerCCEmail, _providerBCCEmail, "", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), _refid, "Liberty", filelist);

        }

        return filelist;

    }

    #region ETIQA

    private void SendEtiqa(Int64 _carid, string _fileloctax, string _fileloccert, string _filelocsched)
    {
        string _email = "";
        string _strSql = "";
        Int64 _ceid = 0;
    
        string[] filelist = new string[3];
        //filelist[0] = @"D:\sharedloc\pdfoutput\etiqa\2011Mar14\Etiqa_TaxInvoice_288.pdf";
        //filelist[1] = @"D:\sharedloc\pdfoutput\etiqa\2011Mar14\Etiqa_CarInsurance_Certificate_288.pdf";
        //filelist[2] = @"D:\sharedloc\pdfoutput\etiqa\2011Mar14\Etiqa_Schedule_288.pdf";

        filelist[0] = _fileloctax;
        filelist[1] = _fileloccert;
        filelist[2] = _filelocsched;
        
        /*string customername = "MOHAMAD BAHROM BIN MOHAMAD SALLEH";
        string ordernumber = "20110314028863000252";
        string policynumber = "DMAP11S900056";*/

        string customername = "";
        string ordernumber = "";
        string policynumber = "";

        MyDatabase _db = new MyDatabase();
        DataTable _dtInsurance = new DataTable();
        DataTable _dtPolicy = new DataTable();

        _strSql = "SELECT OrderNo, Name, RefCEUserId ";
        _strSql += " FROM  tblCarMoreDetail_Etiqa WHERE CECarId = " + _carid.ToString() + " ORDER BY ModifiedDate DESC";
        _dtInsurance = _db.GetDataTable(_strSql);
        if (_dtInsurance.Rows.Count > 0)
        {
            customername = _dtInsurance.Rows[0]["Name"].ToString();
            ordernumber = _dtInsurance.Rows[0]["OrderNo"].ToString();
            _ceid = Convert.ToInt64(_dtInsurance.Rows[0]["RefCEUserId"].ToString());
        }

        _strSql = "";
        _strSql = "SELECT PolicyNumber";
        _strSql += " FROM  tblProviderCarPolicyNumber WHERE Info1 = '" + ordernumber + "' ORDER BY ModifiedDate DESC";
        _dtPolicy = _db.GetDataTable(_strSql);
        if (_dtPolicy.Rows.Count > 0)
        {
            policynumber = _dtPolicy.Rows[0]["PolicyNumber"].ToString();
        }

        _email = getUserEmail(_ceid);

        _email += ";" + CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaCI_TO");
        string _emailcc = CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaCI_CC");
        string _emailbcc = CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaCI_BCC");


        SendEmailWithAttach(filelist, _email, _emailcc, _emailbcc, customername, ordernumber, policynumber);
    }

    private bool SendEmailWithAttach(string[] filelist, string email, string emailCC, string emailBCC, string customername, string ordernumber, string policynumber)
    {
        bool _retValue = false;

        Uri myUri = new Uri(HttpContext.Current.Request.Url.ToString());

        string domainUrl = "http://" + myUri.Host;
        string _etiqaLogoPath = domainUrl;
        _etiqaLogoPath += CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaLogoPath");

        string mailBody = "<br>Dear " + customername.ToUpper() + ",<br><br>";
        mailBody += "<table><tr><td><strong>Policy Number</strong></td><td>:</td><td>" + policynumber + "</td></tr>";
        mailBody += "<tr><td><strong>Payment reference</strong></td><td>:</td><td>" + ordernumber + "</td></tr></table>";
        mailBody += "<br/><br/>Thank you for insuring with Etiqa Insurance Pte Ltd.";//Etiqa Berhad
        mailBody += "<br/><br/>We are pleased to enclose the policy documents as attached for your kind attention.";
        mailBody += "<br/><br />We confirm coverage effective from the insurance commencement date as specified in ";
        mailBody += "the policy documents. If the insurance is to commence today, the time of cover starts ";
        mailBody += "from the time of this email.";
        mailBody += "<br/><br/>If you have any queries, please do not hesitate to contact us at 6331 9222 or email to us at ";
        mailBody += "<a href='mailto:cxmotor@etiqa.com.sg'>cxmotor@etiqa.com.sg </a>";
        mailBody += "<br/><br/>Motor Underwriting Dept";
        mailBody += "<br/>Etiqa Insurance Pte Ltd";
        mailBody += "<br/><img src='" + _etiqaLogoPath + "' alt='Etiqa Insurance Logo' />";
        mailBody += "<br/><br/><br/><style='font-style:italic;'>This document is automatically generated. Please do not respond to this email.</style>";

        string mailTitle = "Confirmation of Coverage with Etiqa (Policy No. " + policynumber + ")";
        if (MyMailManager.SendEtiqaEmailByAttachedmentNew(customername, email, emailCC, emailBCC, mailTitle, mailBody, filelist))
        {
            _retValue = true;
        }
        else
        {
            _retValue = false;
        }

        return _retValue;
    }

    protected string GenerateProposalFormToEtiqa(Int64 RefID, string FilePath, string FileName)
    {
        string _returnFilePath = "";
        //string _filePath = FilePath;
        Label lblContent = new Label();
        //string _fileName = FileName;
        string _applicationdate = " : " + CE.Global.General.GetUTCDateTime().ToString("dd/MMM/yyyy") + " " + CE.Global.General.GetUTCDateTime().ToShortTimeString();
        //string convertno = General.GetRefNumber(RefID);
        //_fileName = "E" + convertno + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;

        StringBuilder strText = new StringBuilder("");
        strText.Append("<table><tr><td colspan='2'><h4>Car Insurance - Proposal Form</h4></td><td colspan='2' align='right'><b>Application Date</b> " + _applicationdate.ToString() + "</td></tr></table>");

        DataSet _dsProposal = new DataSet();
        ProposalDownloadDB _proposaldownloaddb = new ProposalDownloadDB();
        _dsProposal = _proposaldownloaddb.GetEtiqaProposal(RefID, "CI");
        string _html = "";
        try
        {
            if (_dsProposal != null && _dsProposal.Tables[0].Rows.Count > 0)
            {
                #region Variables

                string _name, _unitno, _homeno, _address, _postalcode, _dob, _dd, _mm, _yy, _nationality, _nric, _maritalstatus, _mobile, _occupation;
                string _gender, _expdriving, _vehicleno, _make, _model, _vehicletype, _engineno, _chassisno, _cc, _regyear, _hpstatus, _hpcomp;
                string _insstartdate, _insenddate, _isdd, _ismm, _isyy, _iedd, _iemm, _ieyy, _insstatus, _inscomid, _inscomp, _inspolicyno;
                string _inspldate, _indd, _inmm, _inyy;
                string _drname1, _drdob1, _drdd1, _drmm1, _dryy1, _drocc1, _drexp1, _drname2, _drdob2, _drdd2, _drmm2, _dryy2, _drocc2, _drexp2;
                string _drname3, _drdob3, _drdd3, _drmm3, _dryy3, _drocc3, _drexp3, _drname4, _drdob4, _drdd4, _drmm4, _dryy4, _drocc4, _drexp4;
                string _drname5, _drdob5, _drdd5, _drmm5, _dryy5, _drocc5, _drexp5, _demeritstatus, _demeritcount, _dmdrname1, _dmdrpoint1;
                string _dmdrname2, _dmdrpoint2, _dmdrname3, _dmdrpoint3, _dmdrname4, _dmdrpoint4, _dmdrname5, _dmdrpoint5, _dmdrname6, _dmdrpoint6;
                string _adddriver, _drcount, _claimstatus, _claim1ststat, _claim1stend;
                string claimamt1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3, _ncdstatus, _ncdpercent;
                string _inscancelstatus, _cancelreason, _impairstatus, _impairreason, _planname, _annualpremium;
                string _excess, _email, _natureofbusi, _cxaccountno, _aucode, _policyno, _orderno, _nextNCD, _isOFD, _isNCDProtector;
                DateTime _dofb, _isdate, _iedate, _indate, _drdofb1, _drdofb2, _drdofb3, _drdofb4, _drdofb5;

                _inscancelstatus = ""; _cancelreason = ""; _impairstatus = ""; _impairreason = ""; _demeritstatus = ""; _demeritcount = "";
                _dmdrname1 = ""; _dmdrpoint1 = ""; _dmdrname2 = ""; _dmdrpoint2 = ""; _dmdrname3 = ""; _dmdrpoint3 = ""; _dmdrname4 = "";
                _dmdrpoint4 = ""; _dmdrname5 = ""; _dmdrpoint5 = ""; _dmdrname6 = ""; _dmdrpoint6 = ""; _vehicletype = ""; _expdriving = "";
                _drname1 = ""; _drdob1 = ""; _drdd1 = ""; _drmm1 = ""; _dryy1 = ""; _drocc1 = ""; _drexp1 = "";
                _drname2 = ""; _drdob2 = ""; _drdd2 = ""; _drmm2 = ""; _dryy2 = ""; _drocc2 = ""; _drexp2 = "";
                _drname3 = ""; _drdob3 = ""; _drdd3 = ""; _drmm3 = ""; _dryy3 = ""; _drocc3 = ""; _drexp3 = "";
                _drname4 = ""; _drdob4 = ""; _drdd4 = ""; _drmm4 = ""; _dryy4 = ""; _drocc4 = ""; _drexp4 = "";
                _drname5 = ""; _drdob5 = ""; _drdd5 = ""; _drmm5 = ""; _dryy5 = ""; _drocc5 = ""; _drexp5 = ""; _planname = ""; _annualpremium = "";
                _adddriver = ""; _drcount = "";

                #endregion

                #region Assign Values

                _name = _dsProposal.Tables[0].Rows[0]["Name"].ToString();
                _dofb = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["DOB"].ToString());
                _dd = _dofb.Day.ToString("00");
                _mm = _dofb.Month.ToString("00");
                _yy = _dofb.Year.ToString();
                //_dob = _dd + "/" + _mm + "/" + _yy;
                _dob = _dsProposal.Tables[0].Rows[0]["DOB"].ToString();
                _nationality = _dsProposal.Tables[0].Rows[0]["Nationality"].ToString();
                _unitno = _dsProposal.Tables[0].Rows[0]["UnitNo"].ToString();
                _homeno = _dsProposal.Tables[0].Rows[0]["HomeNo"].ToString();
                _address = _dsProposal.Tables[0].Rows[0]["Address"].ToString();
                _postalcode = _dsProposal.Tables[0].Rows[0]["PostalCode"].ToString();
                _nric = _dsProposal.Tables[0].Rows[0]["NRICNo"].ToString();
                _maritalstatus = _dsProposal.Tables[0].Rows[0]["Marital"].ToString();
                _gender = _dsProposal.Tables[0].Rows[0]["Gender"].ToString();

                _email = _dsProposal.Tables[0].Rows[0]["Email"].ToString();
                _natureofbusi = _dsProposal.Tables[0].Rows[0]["NofBusi"].ToString();
                _nextNCD = _dsProposal.Tables[0].Rows[0]["NCDNextPercent"].ToString();
                _isNCDProtector = _dsProposal.Tables[0].Rows[0]["IsNCDProtector"].ToString(); ;
                _isOFD = _dsProposal.Tables[0].Rows[0]["IsOffDriveCom"].ToString();

                _planname = _dsProposal.Tables[0].Rows[0]["PlanName"].ToString();
                _annualpremium = _dsProposal.Tables[0].Rows[0]["AnnualPremium"].ToString();

                _expdriving = _dsProposal.Tables[0].Rows[0]["YearDriveSg"].ToString();
                _occupation = _dsProposal.Tables[0].Rows[0]["Description"].ToString();
                _mobile = _dsProposal.Tables[0].Rows[0]["ContactNo"].ToString();

                _excess = _dsProposal.Tables[0].Rows[0]["Excess"].ToString();
                //if (_planname.Trim() == "Panel Workshops")
                //{
                //    double _dexcess = (double.Parse(_excess)) / 2;
                //    _excess = _dexcess.ToString();
                //}

                if (_dsProposal.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "False")
                {
                    _claimstatus = "No";
                }
                else
                {
                    _claimstatus = "Yes";
                }
                if (_dsProposal.Tables[0].Rows[0]["HasPreInsurer"].ToString() == "True")
                {
                    _insstatus = "Yes";
                    if (_dsProposal.Tables[2].Rows.Count > 0)
                    {
                        _inscomp = _dsProposal.Tables[2].Rows[0]["InsCompanyName"].ToString();
                        _inspolicyno = _dsProposal.Tables[0].Rows[0]["PreInsPolicyNo"].ToString();
                        _indate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString());
                        _indd = _indate.Day.ToString("00");
                        _inmm = _indate.Month.ToString("00");
                        _inyy = _indate.Year.ToString();
                        _inspldate = _indd + "/" + _inmm + "/" + _inyy;
                        //_inspldate = _dsProposal.Tables[0].Rows[0]["PreInsExpiryDate"].ToString();
                        _inscomid = _dsProposal.Tables[0].Rows[0]["PreInsurerName"].ToString();
                    }
                    else
                    {
                        _insstatus = "No";
                        _inscomp = "Not Applicable";
                        _inspolicyno = "";
                        _inspldate = "";
                        _inscomid = "01";
                    }
                }
                else
                {
                    _insstatus = "No";
                    _inscomp = "Not Applicable";
                    _inspolicyno = "";
                    _inspldate = "";
                    _inscomid = "01";
                }


                _cxaccountno = _dsProposal.Tables[0].Rows[0]["CXAccountNo"].ToString();
                _policyno = _dsProposal.Tables[0].Rows[0]["PolicyNumber"].ToString();
                _aucode = _dsProposal.Tables[0].Rows[0]["AuCode"].ToString();
                _orderno = _dsProposal.Tables[0].Rows[0]["OrderNo"].ToString();


                _ncdpercent = _dsProposal.Tables[0].Rows[0]["NCDPercent"].ToString();
                if (_ncdpercent.ToString() == "-1")
                {
                    _ncdpercent = "No NCD(First Policy)";
                }
                else
                {
                    _ncdpercent += "%";
                }

                if (_dsProposal.Tables[1].Rows.Count > 0)
                {
                    _claim1ststat = _dsProposal.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
                    _claim1stend = _dsProposal.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
                    claimamt1 = _dsProposal.Tables[1].Rows[0]["NOCLast1Value"].ToString();

                    _claim2ndstat = _dsProposal.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
                    _claim2ndend = _dsProposal.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
                    claimamt2 = _dsProposal.Tables[1].Rows[0]["NOCLast2Value"].ToString();

                    _claim3rdstat = _dsProposal.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
                    _claim3rdend = _dsProposal.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
                    claimamt3 = _dsProposal.Tables[1].Rows[0]["NOCLast3Value"].ToString();
                }
                else
                {
                    _claim1ststat = "";
                    _claim1stend = "";
                    claimamt1 = "";

                    _claim2ndstat = "";
                    _claim2ndend = "";
                    claimamt2 = "";

                    _claim3rdstat = "";
                    _claim3rdend = "";
                    claimamt3 = "";
                    _claimstatus = "No";
                }
                if (_dsProposal.Tables[0].Rows[0]["HasInsuranceTerminated"].ToString() == "True")
                {
                    _inscancelstatus = "Yes";
                    _cancelreason = _dsProposal.Tables[0].Rows[0]["InsuranceTerminatedReason"].ToString();
                }
                else
                {
                    _inscancelstatus = "No";
                    _cancelreason = "";
                }

                if (_dsProposal.Tables[0].Rows[0]["HasPhysicalImpairment"].ToString() == "True")
                {
                    _impairstatus = "Yes";
                    _impairreason = _dsProposal.Tables[0].Rows[0]["PhysicalImpairmentReason"].ToString();
                }
                else
                {
                    _impairstatus = "No";
                    _impairreason = "";
                }

                if (_dsProposal.Tables[0].Rows[0]["HasDemeritPoints"].ToString() == "True")
                {
                    if (_dsProposal.Tables[6].Rows.Count > 0)
                    {
                        _demeritstatus = "Yes";
                        _demeritcount = _dsProposal.Tables[6].Rows.Count.ToString();

                        _dmdrname1 = _dsProposal.Tables[6].Rows[0]["DriverName"].ToString();
                        _dmdrpoint1 = _dsProposal.Tables[6].Rows[0]["TotalDemeritPoints"].ToString();
                        if (_dsProposal.Tables[6].Rows.Count > 1)
                        {
                            _dmdrname2 = _dsProposal.Tables[6].Rows[1]["DriverName"].ToString();
                            _dmdrpoint2 = _dsProposal.Tables[6].Rows[1]["TotalDemeritPoints"].ToString();
                        }
                        if (_dsProposal.Tables[6].Rows.Count > 2)
                        {
                            _dmdrname3 = _dsProposal.Tables[6].Rows[2]["DriverName"].ToString();
                            _dmdrpoint3 = _dsProposal.Tables[6].Rows[2]["TotalDemeritPoints"].ToString();
                        }
                        if (_dsProposal.Tables[6].Rows.Count > 3)
                        {
                            _dmdrname4 = _dsProposal.Tables[6].Rows[3]["DriverName"].ToString();
                            _dmdrpoint4 = _dsProposal.Tables[6].Rows[3]["TotalDemeritPoints"].ToString();
                        }
                        if (_dsProposal.Tables[6].Rows.Count > 4)
                        {
                            _dmdrname5 = _dsProposal.Tables[6].Rows[4]["DriverName"].ToString();
                            _dmdrpoint5 = _dsProposal.Tables[6].Rows[4]["TotalDemeritPoints"].ToString();
                        }
                        if (_dsProposal.Tables[6].Rows.Count > 5)
                        {
                            _dmdrname6 = _dsProposal.Tables[6].Rows[5]["DriverName"].ToString();
                            _dmdrpoint6 = _dsProposal.Tables[6].Rows[5]["TotalDemeritPoints"].ToString();
                        }
                    }
                    else
                    {
                        _demeritstatus = "No";
                        _demeritcount = "0";
                    }
                }
                else
                {
                    _demeritstatus = "No";
                    _demeritcount = "0";
                }

                _vehicleno = _dsProposal.Tables[0].Rows[0]["VechicleNo"].ToString();
                _regyear = _dsProposal.Tables[0].Rows[0]["RegYear"].ToString();
                _model = _dsProposal.Tables[5].Rows[0]["Description"].ToString();
                _make = _dsProposal.Tables[5].Rows[0]["Make"].ToString(); ;
                _cc = _dsProposal.Tables[5].Rows[0]["CC"].ToString();
                _vehicletype = _dsProposal.Tables[5].Rows[0]["Body"].ToString();
                _engineno = _dsProposal.Tables[0].Rows[0]["EngineNo"].ToString();
                _chassisno = _dsProposal.Tables[0].Rows[0]["ChassisNo"].ToString();

                _isdate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["StartDate"].ToString());
                _isdd = _isdate.Day.ToString("00");
                _ismm = _isdate.Month.ToString("00");
                _isyy = _isdate.Year.ToString();
                _insstartdate = _isdd + "/" + _ismm + "/" + _isyy;
                //_insstartdate = _dsProposal.Tables[0].Rows[0]["StartDate"].ToString();

                _iedate = Convert.ToDateTime(_dsProposal.Tables[0].Rows[0]["EndDate"].ToString());
                _iedd = _iedate.Day.ToString("00");
                _iemm = _iedate.Month.ToString("00");
                _ieyy = _iedate.Year.ToString();
                _insenddate = _iedd + "/" + _iemm + "/" + _ieyy;
                //_insenddate = _dsProposal.Tables[0].Rows[0]["EndDate"].ToString();

                if (_dsProposal.Tables[3].Rows.Count > 0)
                {
                    _hpstatus = "Yes";
                    _hpcomp = _dsProposal.Tables[3].Rows[0]["HPCompanyName"].ToString();

                    if (_hpcomp.ToString() == "")
                    {
                        _hpcomp = "Not Applicable";
                    }
                }
                else
                {
                    _hpstatus = "No";
                    _hpcomp = "Not Applicable";
                }
                if (_dsProposal.Tables[0].Rows[0]["AddDriver"].ToString() == "Yes")
                {
                    _adddriver = "Yes";
                    _drcount = _dsProposal.Tables[0].Rows[0]["NoOfDriver"].ToString();
                }
                else
                {
                    _adddriver = "No";
                    _drcount = "0";
                }
                if (_dsProposal.Tables[4].Rows.Count > 0)
                {
                    if (Convert.ToInt16(_drcount) > 0)
                    {
                        _drname1 = _dsProposal.Tables[4].Rows[0]["DriverName"].ToString();
                        _drdofb1 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[0]["DOB"].ToString());
                        _drdd1 = _drdofb1.Day.ToString("00");
                        _drmm1 = _drdofb1.Month.ToString("00");
                        _dryy1 = _drdofb1.Year.ToString();
                        //_drdob1 = _drdd1 + "/" + _drmm1 + "/" + _dryy1;
                        _drdob1 = _dsProposal.Tables[4].Rows[0]["DOB"].ToString();
                        _drocc1 = _dsProposal.Tables[4].Rows[0]["Description"].ToString();
                        _drexp1 = _dsProposal.Tables[4].Rows[0]["YearOfDrivingInSg"].ToString();
                    }
                    if (Convert.ToInt16(_drcount) > 1)
                    {
                        _drname2 = _dsProposal.Tables[4].Rows[1]["DriverName"].ToString();
                        _drdofb2 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[1]["DOB"].ToString());
                        _drdd2 = _drdofb2.Day.ToString("00");
                        _drmm2 = _drdofb2.Month.ToString("00");
                        _dryy2 = _drdofb2.Year.ToString();
                        //_drdob2 = _drdd2 + "/" + _drmm2 + "/" + _dryy2;
                        _drdob2 = _dsProposal.Tables[4].Rows[1]["DOB"].ToString();
                        _drocc2 = _dsProposal.Tables[4].Rows[1]["Description"].ToString();
                        _drexp2 = _dsProposal.Tables[4].Rows[1]["YearOfDrivingInSg"].ToString();
                    }
                    if (Convert.ToInt16(_drcount) > 2)
                    {
                        _drname3 = _dsProposal.Tables[4].Rows[2]["DriverName"].ToString();
                        _drdofb3 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[2]["DOB"].ToString());
                        _drdd3 = _drdofb3.Day.ToString("00");
                        _drmm3 = _drdofb3.Month.ToString("00");
                        _dryy3 = _drdofb3.Year.ToString();
                        //_drdob3 = _drdd3 + "/" + _drmm3 + "/" + _dryy3;
                        _drdob3 = _dsProposal.Tables[4].Rows[2]["DOB"].ToString();
                        _drocc3 = _dsProposal.Tables[4].Rows[2]["Description"].ToString();
                        _drexp3 = _dsProposal.Tables[4].Rows[2]["YearOfDrivingInSg"].ToString();
                    }
                    if (Convert.ToInt16(_drcount) > 3)
                    {
                        _drname4 = _dsProposal.Tables[4].Rows[3]["DriverName"].ToString();
                        _drdofb4 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[3]["DOB"].ToString());
                        _drdd4 = _drdofb4.Day.ToString("00");
                        _drmm4 = _drdofb4.Month.ToString("00");
                        _dryy4 = _drdofb4.Year.ToString();
                        //_drdob4 = _drdd4 + "/" + _drmm4 + "/" + _dryy4;
                        _drdob4 = _dsProposal.Tables[4].Rows[3]["DOB"].ToString();
                        _drocc4 = _dsProposal.Tables[4].Rows[3]["Description"].ToString();
                        _drexp4 = _dsProposal.Tables[4].Rows[3]["YearOfDrivingInSg"].ToString();
                    }
                    if (Convert.ToInt16(_drcount) > 4)
                    {
                        _drname5 = _dsProposal.Tables[4].Rows[4]["DriverName"].ToString();
                        _drdofb5 = Convert.ToDateTime(_dsProposal.Tables[4].Rows[4]["DOB"].ToString());
                        _drdd5 = _drdofb5.Day.ToString("00");
                        _drmm5 = _drdofb5.Month.ToString("00");
                        _dryy5 = _drdofb5.Year.ToString();
                        //_drdob5 = _drdd5 + "/" + _drmm5 + "/" + _dryy5;
                        _drdob5 = _dsProposal.Tables[4].Rows[4]["DOB"].ToString();
                        _drocc5 = _dsProposal.Tables[4].Rows[4]["Description"].ToString();
                        _drexp5 = _dsProposal.Tables[4].Rows[4]["YearOfDrivingInSg"].ToString();
                    }
                }

                #endregion

                #region Excel Generation

                //_html = "<table><tr><td width='25%'><b>Plan Name</b></td><td>" + _planname + "</td><td colspan='2' align='right'><b>Annual Premium</b> : $" + _annualpremium.ToString() + "</td></tr></table>";
                //_html += "<div><div><b>Details of Proposer</b></div><div style='text-align: center'>"
                _html = "<table><tr><td width='25%'><b>Plan Name</b></td><td>" + _planname + "</td><td colspan='2' align='right'><b>Annual Premium</b> : $" + _annualpremium.ToString() + "</td></tr>";
                _html += "<tr><td colspan='2'><b>Details of Proposer</b></td><td colspan='2' align='right'><b>Excess Amount</b> : $" + _excess.ToString() + "</td></tr></table>";
                _html += "<div><div style='text-align: center'>"
                         + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
                         + "<tr>"
                         + "<td width='50%'>" //Start 1
                         + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Name</td>"
                         + "<td width='50%' align='left'>" + _name.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td align='left'>Address</td>"
                         + "<td align='left'>"
                         + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0'>"
                         + "<tr><td align='left'>#" + _unitno.ToString() + " - " + _homeno.ToString() + "</td></tr>"
                         + "<tr><td align='left'>" + _address.ToString() + "</td></tr>"
                         + "<tr><td align='left'>Postal Code " + _postalcode.ToString() + "</td></tr>"
                         + "</table>"
                         + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Email</td>"
                         + "<td width='50%' align='left'>" + _email.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Occupation / Business</td>"
                         + "<td width='50%' align='left'>" + _occupation.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Contact No</td>"
                         + "<td width='50%' align='left'>" + _mobile.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Existing NCD</td>"
                         + "<td width='50%' align='left'>" + _ncdpercent.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>OFD</td>"
                         + "<td width='50%' align='left'>" + _isOFD.ToString() + "</td>"
                         + "</tr>"

                         + "</table>"
                         + "</td>" //End 1

                         + "<td width='50%'>" //Start 2
                         + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Date of Birth</td>"
                         + "<td width='50%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dob.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Nationality</td>"
                         + "<td width='50%' align='left'>" + _nationality.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>NRIC Number</td>"
                         + "<td width='50%' align='left'>" + _nric.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Sex</td>"
                         + "<td width='50%' align='left'>" + _gender.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Marital Status</td>"
                         + "<td width='50%' align='left'>" + _maritalstatus.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Nature of Business</td>"
                         + "<td width='50%' align='left'>" + _natureofbusi.ToString() + "</td>"
                         + "</tr>"

                         + "<tr>"
                         + "<td width='50%' align='left'>Driving Experience</td>"
                         + "<td width='50%' align='left'>" + _expdriving.ToString() + "</td>"
                         + "</tr>"

                          + "<tr>"
                         + "<td width='50%' align='left'>NCD upon renewal</td>"
                         + "<td width='50%' align='left'>" + _nextNCD.ToString() + "</td>"
                         + "</tr>"

                          + "<tr>"
                         + "<td width='50%' align='left'>Is NCDProtector</td>"
                         + "<td width='50%' align='left'>" + _isNCDProtector.ToString() + "</td>"
                         + "</tr>"

                         + "</table>"
                         + "</td>" //End 2
                         + "</tr>"

                         + "<tr>"
                         + "<td colspan='2'>"
                         + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                         + "<tr><td colspan='4' align='left'><b>Particulars of Vehicle</b></td></tr>"

                         + "<tr><td style='width:25%' align='left'>Registration No</td>"
                         + "<td style='width: 25%' align='left'>" + _vehicleno.ToString() + "</td>"
                         + "<td style='width: 25%' align='left'>Year of Registration</td>"
                         + "<td style='width: 25%' align='left'>" + _regyear.ToString() + "</td></tr>"

                         + "<tr><td style='width:25%' align='left'>Make of Vehicle</td>"
                         + "<td style='width: 25%' align='left'>" + _make.ToString() + "</td>"
                         + "<td style='width: 25%' align='left'>Vehicle Model</td>"
                         + "<td style='width: 25%' align='left'>" + _model.ToString() + "</td></tr>"

                         + "<tr><td style='width:25%' align='left'>Vehicle Type</td>"
                         + "<td style='width: 25%' align='left'>" + _vehicletype.ToString() + "</td>"
                         + "<td style='width: 25%' align='left'>Engine capacity</td>"
                         + "<td style='width: 25%' align='left'>" + _cc.ToString() + "cc</td></tr>"

                         + "<tr><td style='width:25%' align='left'>Engine No</td>"
                         + "<td style='width: 25%' align='left'>" + _engineno.ToString() + "</td>"
                         + "<td style='width: 25%' align='left'>Chassis No</td>"
                         + "<td style='width: 25%' align='left'>" + _chassisno.ToString() + "</td></tr>"

                         + "<tr><td colspan='4' align='left'><b>Additional drivers : </b>" + _adddriver.ToString() + "</td></tr>";

                if (Convert.ToInt16(_drcount) > 0)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 1</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _drname1.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Date of Birth</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob1.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc1.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp1.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 2</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _drname2.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Date of Birth</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob2.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc2.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp2.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 3</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _drname3.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Date of Birth</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob3.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc3.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp3.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 4</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _drname4.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Date of Birth</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob4.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc4.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp4.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 5</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _drname5.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Date of Birth</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drdob5.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc5.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp5.ToString() + "</td></tr>";
                }

                _html += "<tr><td colspan='4' align='left'>Period of insurance</td></tr>"

                + "<tr><td style='width:25%' align='left'>From</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _insstartdate.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>To</td>"
                + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _insenddate.ToString() + "</td></tr>"

                + "<tr><td style='width:25%' align='left'>Is this vehicle under Hire Purchase?</td>"
                + "<td style='width: 25%' align='left'>" + _hpstatus.ToString() + "</td>"
                + "<td style='width: 25%' align='left'>Name of finance Company</td>"
                + "<td style='width: 25%' align='left'>" + _hpcomp.ToString() + "</td></tr>";

                if (_insstatus == "Yes" && _inscomid != "01" && _inscomid != "177")
                {
                    _html += "<tr><td style='width: 25%' align='left'>Current Insurance Company</td>"
                            + "<td colspan='3' align='left'>" + _inscomp.ToString() + "</td></tr>"

                            + "<tr><td style='width:25%' align='left'>Policy No.</td>"
                            + "<td style='width:25%' align='left'>" + _inspolicyno.ToString() + "</td>"
                            + "<td style='width: 25%' align='left'>Expiry Date</td>"
                            + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _inspldate.ToString() + "</td></tr>";
                }
                else
                {
                    _html += "<tr><td style='width: 25%' align='left'>Current Insurance Company</td>"
                            + "<td colspan='3' align='left'>" + _inscomp.ToString() + "</td></tr>";
                }
                _html += "<tr>"
                + "<td colspan='4' align='left'>Claim history o proposer & named / Authorised Driver(s)(Last 3 years) : " + _claimstatus.ToString() + "</td>"
                + "</tr>";
                if (_claimstatus.ToString() == "Yes")
                {
                    if (claimamt1.ToString() != "0" && claimamt1.ToString() != "")
                    {
                        _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                        + "<td style='width:25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _claim1ststat.ToString() + " to " + _claim1stend.ToString() + "</td>"
                        + "<td style='width: 25%' align='left'> Claim Amount</td>"
                        + "<td style='width: 25%' align='left'>" + claimamt1.ToString() + "</td></tr>";
                    }
                    if (claimamt2.ToString() != "0" && claimamt2.ToString() != "")
                    {
                        _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim2ndstat.ToString() + " to " + _claim2ndend.ToString() + "</td>"
                        + "<td style='width: 25%' align='left'> Claim Amount</td>"
                        + "<td style='width: 25%' align='left'>" + claimamt2.ToString() + "</td></tr>";
                    }
                    if (claimamt3.ToString() != "0" && claimamt3.ToString() != "")
                    {
                        _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim3rdstat.ToString() + " to " + _claim3rdend.ToString() + "</td>"
                        + "<td style='width: 25%' align='left'> Claim Amount</td>"
                        + "<td style='width: 25%' align='left'>" + claimamt3.ToString() + "</td></tr>";
                    }
                }
                _html += "<tr><td colspan='4' align='left'><b>General Questions</td></tr>"

                + "<tr><td colspan='3' align='left'>Have you or your named driver(s) been given / accumulated demerit points during the last 24 months?</td>"
                + "<td style='width: 25%' align='left'>" + _demeritstatus.ToString() + "</td></tr>";
                if (Convert.ToInt16(_demeritcount) > 0)
                {
                    _html += "<tr><td style='width:25%' align='left'>1. Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrname1.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrpoint1.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_demeritcount) > 1)
                {
                    _html += "<tr><td style='width:25%' align='left'>2. Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrname2.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrpoint2.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_demeritcount) > 2)
                {
                    _html += "<tr><td style='width:25%' align='left'>3. Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrname3.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrpoint3.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_demeritcount) > 3)
                {
                    _html += "<tr><td style='width:25%' align='left'>4. Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrname4.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrpoint4.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_demeritcount) > 4)
                {
                    _html += "<tr><td style='width:25%' align='left'>5. Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrname5.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrpoint5.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_demeritcount) > 5)
                {
                    _html += "<tr><td style='width:25%' align='left'>5. Driver Name</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrname6.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Total Demerit Points</td>"
                    + "<td style='width: 25%' align='left'>" + _dmdrpoint6.ToString() + "</td></tr>";
                }
                _html += "<tr><td colspan='3' align='left'>Have you or your named driver(s) had any motor insurance proposal declined, cancelled or renewal rejected by any insurance company?</td>"
                + "<td style='width: 25%' align='left'>" + _inscancelstatus.ToString() + "</td></tr>";
                if (_inscancelstatus.ToString() == "Yes")
                {
                    _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
                    + "<td colspan='3' align='left'>" + _cancelreason.ToString() + "</td></tr>";
                }
                _html += "<tr><td colspan='3' align='left'>Have you or your named driver(s) suffered any disease or infirmity that could impair the ability to drive?</td>"
                        + "<td style='width: 25%' align='left'>" + _impairstatus.ToString() + "</td></tr>";
                if (_inscancelstatus.ToString() == "Yes")
                {
                    _html += "<tr><td style='width: 25%' align='left'>Reason</td>"
                    + "<td colspan='3' align='left'>" + _impairreason.ToString() + "</td></tr>";
                }

                _html += "<tr><td colspan='4' align='left'></td></tr>";
                _html += "<tr><td>Account No.</td><td>[" + _cxaccountno + "]</td><td>Policy No.</td><td>[" + _policyno + "]</td></tr>";
                _html += "<tr><td>Order No.</td><td>[" + _orderno + "]</td><td>AuCode</td><td>[" + _aucode + "]</td></tr>";

                _html += "</table>"
                + "</td>"
                + "</tr>"

                + "</table>"
                + "</div></div>";

                #endregion

                lblContent.Text = _html;
                MyIO myio = new MyIO();

                string[] filecontent = new string[1];
                filecontent[0] = strText + lblContent.Text.ToString();

                //_filePath = GetFilePath();
                myio.WriteNewFile(FilePath, FileName + ".xls", filecontent);
                _returnFilePath = FilePath + FileName + ".xls";
                ////SEND MAIL
                //string _providerEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaCI_TO");
                //string _providerCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaCI_CC");
                //string _providerBCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("EtiqaCI_BCC");


                ////string _providerEmail = "cherylmae.lanot@teledirect.com.sg";
                //string[] filelist = new string[1];
                ////string _excelfile = Server.MapPath("proposalforms/" + _fileName + ".xls");
                //string _excelfile = Server.MapPath("~/exceloutput/" + _fileName + ".xls");
                //filelist[0] = _excelfile;
                //string _refid = "E" + convertno;
                //MyMailManager.SendCarProposalAttachment("Etiqa Insurance", _providerEmail, _providerCCEmail, _providerBCCEmail, "", CE.Global.General.GetUTCDateTime().ToShortDateString(), CE.Global.General.GetUTCDateTime().ToShortTimeString(), _refid, "Etiqa", filelist);

            }
        }
        catch (Exception Ex)
        {
            Ex = null;
        }

        return _returnFilePath;

    }

    #endregion


}
